Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

consrv.h File Reference

Go to the source code of this file.

Classes

struct  tagFACENODE

Defines

#define DBGFONTS(_params_)
#define DBGFONTS2(_params_)
#define DBGCHARS(_params_)
#define DBGOUTPUT(_params_)
#define DBGFULLSCR(_params_)
#define DBGPRINT(_params_)
#define CONSOLE_MAX_FONT_NAME_LENGTH   256
#define DATA_CHUNK_SIZE   8192
#define MAKE_TAG(t)   (RTL_HEAP_MAKE_TAG( dwConBaseTag, t ))
#define TMP_TAG   0
#define BMP_TAG   1
#define ALIAS_TAG   2
#define HISTORY_TAG   3
#define TITLE_TAG   4
#define HANDLE_TAG   5
#define CONSOLE_TAG   6
#define ICON_TAG   7
#define BUFFER_TAG   8
#define WAIT_TAG   9
#define FONT_TAG   10
#define SCREEN_TAG   11
#define GetWindowConsole(hWnd)   (PCONSOLE_INFORMATION)GetWindowLongPtr((hWnd), GWLP_USERDATA)
#define SetConsoleBkColor(hw, clr)   SetWindowLong(hw, GWL_CONSOLE_BKCOLOR, clr)
#define SetConsolePid(hw, pid)   SetWindowLong(hw, GWL_CONSOLE_PID, pid)
#define SetConsoleTid(hw, tid)   SetWindowLong(hw, GWL_CONSOLE_TID, tid)
#define NELEM(array)   (sizeof(array)/sizeof(array[0]))
#define CON_FAMILY(pCon)   SCR_FAMILY((pCon)->CurrentScreenBuffer)
#define CON_FONTNUMBER(pCon)   SCR_FONTNUMBER((pCon)->CurrentScreenBuffer)
#define CON_FACENAME(pCon)   SCR_FACENAME((pCon)->CurrentScreenBuffer)
#define CON_FONTSIZE(pCon)   SCR_FONTSIZE((pCon)->CurrentScreenBuffer)
#define CON_FONTWEIGHT(pCon)   SCR_FONTWEIGHT((pCon)->CurrentScreenBuffer)
#define CON_FONTCODEPAGE(pCon)   SCR_FONTCODEPAGE((pCon)->CurrentScreenBuffer)
#define CONSOLE_IS_DBCS_ENABLED()   (FALSE)
#define CONSOLE_IS_IME_ENABLED()   (FALSE)
#define LoadStringEx   LoadStringExA
#define ValidateConsoleHeap()
#define ConsoleHeapAlloc(Flags, Size)   Win32HeapAlloc(pConHeap, Size, Flags, Flags)
#define ConsoleHeapReAlloc(Flags, Address, Size)   Win32HeapReAlloc(pConHeap, Address, Size, Flags)
#define ConsoleHeapFree(Address)
#define ConsoleHeapSize(Address)   Win32HeapSize(pConHeap, Address)
#define LockConsoleHandleTable()   RtlEnterCriticalSection(&ConsoleHandleLock)
#define UnlockConsoleHandleTable()   RtlLeaveCriticalSection(&ConsoleHandleLock)
#define LockConsole(Con)   RtlEnterCriticalSection(&(Con)->ConsoleLock)
#define ConvertAttrToRGB(Con, Attr)   ((Con)->ColorTable[(Attr) & 0x0F])
#define CONSOLE_SHUTDOWN_FAILED   0
#define CONSOLE_SHUTDOWN_SUCCEEDED   1
#define CONSOLE_SHUTDOWN_SYSTEM   2
#define LINK_NOINFO   0
#define LINK_SIMPLEINFO   1
#define LINK_FULLINFO   2
#define EF_NEW   0x0001
#define EF_OLD   0x0002
#define EF_ENUMERATED   0x0004
#define EF_OEMFONT   0x0008
#define EF_TTFONT   0x0010
#define EF_DEFFACE   0x0020
#define SCREEN_BUFFER_POINTER(X, Y, XSIZE, CELLSIZE)   (((XSIZE * (Y)) + (X)) * (ULONG)CELLSIZE)
#define W32PF_ALLOWSETFOREGROUND   0x00080000
#define W32PF_CONSOLEHASFOCUS   0x04000000

Typedefs

typedef tagFACENODE FACENODE
typedef tagFACENODEPFACENODE

Functions

__inline BYTE SCR_FAMILY (PSCREEN_INFORMATION pScreen)
__inline DWORD SCR_FONTNUMBER (PSCREEN_INFORMATION pScreen)
__inline LPWSTR SCR_FACENAME (PSCREEN_INFORMATION pScreen)
__inline COORD SCR_FONTSIZE (PSCREEN_INFORMATION pScreen)
__inline LONG SCR_FONTWEIGHT (PSCREEN_INFORMATION pScreen)
__inline UINT SCR_FONTCODEPAGE (PSCREEN_INFORMATION pScreen)
NTSTATUS ConsoleAddProcessRoutine (IN PCSR_PROCESS ParentProcess, IN PCSR_PROCESS Process)
NTSTATUS DereferenceConsoleHandle (IN HANDLE ConsoleHandle, OUT PCONSOLE_INFORMATION *Console)
NTSTATUS AllocateConsoleHandle (OUT PHANDLE Handle)
NTSTATUS FreeConsoleHandle (IN HANDLE Handle)
NTSTATUS ValidateConsole (IN PCONSOLE_INFORMATION Console)
NTSTATUS ApiPreamble (IN HANDLE ConsoleHandle, OUT PCONSOLE_INFORMATION *Console)
NTSTATUS RevalidateConsole (IN HANDLE ConsoleHandle, OUT PCONSOLE_INFORMATION *Console)
NTSTATUS InitializeConsoleHandleTable (VOID)
BOOLEAN UnProtectHandle (HANDLE hObject)
NTSTATUS AllocateConsole (IN HANDLE ConsoleHandle, IN LPWSTR Title, IN USHORT TitleLength, IN HANDLE ClientProcessHandle, OUT PHANDLE StdIn, OUT PHANDLE StdOut, OUT PHANDLE StdErr, OUT PCONSOLE_PER_PROCESS_DATA ProcessData, IN OUT PCONSOLE_INFO ConsoleInfo, IN BOOLEAN WindowVisible, IN DWORD ConsoleThreadId)
VOID DestroyConsole (IN PCONSOLE_INFORMATION Console)
VOID FreeCon (IN PCONSOLE_INFORMATION Console)
VOID InsertScreenBuffer (IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo)
VOID RemoveScreenBuffer (IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo)
VOID FreeProcessData (IN PCONSOLE_PER_PROCESS_DATA ProcessData)
NTSTATUS AllocateIoHandle (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN ULONG HandleType, OUT PHANDLE Handle)
NTSTATUS GrowIoHandleTable (IN PCONSOLE_PER_PROCESS_DATA ProcessData)
NTSTATUS FreeIoHandle (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN HANDLE Handle)
NTSTATUS DereferenceIoHandleNoCheck (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN HANDLE Handle, OUT PHANDLE_DATA *HandleData)
NTSTATUS DereferenceIoHandle (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN HANDLE Handle, IN ULONG HandleType, IN ACCESS_MASK Access, OUT PHANDLE_DATA *HandleData)
BOOLEAN InitializeInputHandle (PHANDLE_DATA HandleData, PINPUT_INFORMATION InputBuffer)
VOID InitializeOutputHandle (PHANDLE_DATA HandleData, PSCREEN_INFORMATION ScreenBuffer)
ULONG SrvVerifyConsoleIoHandle (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS ConsoleAddShare (IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN OUT PCONSOLE_SHARE_ACCESS ShareAccess, IN OUT PHANDLE_DATA HandleData)
NTSTATUS ConsoleDupShare (IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN OUT PCONSOLE_SHARE_ACCESS ShareAccess, IN OUT PHANDLE_DATA TargetHandleData)
NTSTATUS ConsoleRemoveShare (IN ULONG DesiredAccess, IN ULONG DesiredShareAccess, IN OUT PCONSOLE_SHARE_ACCESS ShareAccess)
VOID DoFind (IN PCONSOLE_INFORMATION Console)
VOID ScrollScreen (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT ScrollRect, IN PSMALL_RECT MergeRect, IN COORD TargetPoint)
VOID SetProcessForegroundRights (IN PCSR_PROCESS Process, IN BOOL Foreground)
VOID SetProcessFocus (IN PCSR_PROCESS Process, IN BOOL Foreground)
VOID ModifyConsoleProcessFocus (IN PCONSOLE_INFORMATION Console, IN BOOL Foreground)
VOID InitializeSystemMetrics (VOID)
VOID InitializeScreenInfo (VOID)
NTSTATUS ReadScreenBuffer (IN PSCREEN_INFORMATION ScreenInformation, OUT PCHAR_INFO Buffer, IN OUT PSMALL_RECT ReadRegion)
NTSTATUS WriteScreenBuffer (IN PSCREEN_INFORMATION ScreenInformation, OUT PCHAR_INFO Buffer, IN OUT PSMALL_RECT WriteRegion)
NTSTATUS DoCreateScreenBuffer (IN PCONSOLE_INFORMATION Console, IN PCONSOLE_INFO ConsoleInfo)
NTSTATUS CreateScreenBuffer (OUT PSCREEN_INFORMATION *ScreenInformation, IN COORD dwWindowSize OPTIONAL, IN DWORD nFont OPTIONAL, IN COORD dwScreenBufferSize OPTIONAL, IN CHAR_INFO Fill, IN CHAR_INFO PopupFill, IN PCONSOLE_INFORMATION Console, IN DWORD Flags, IN PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo OPTIONAL, OUT PVOID *lpBitmap, OUT HANDLE *hMutex, IN UINT CursorSize, IN LPWSTR FaceName)
VOID AbortCreateConsole (IN PCONSOLE_INFORMATION Console)
NTSTATUS CreateWindowsWindow (IN PCONSOLE_INFORMATION Console)
VOID DestroyWindowsWindow (IN PCONSOLE_INFORMATION Console)
NTSTATUS FreeScreenBuffer (IN PSCREEN_INFORMATION ScreenInformation)
NTSTATUS ReadOutputString (IN PSCREEN_INFORMATION ScreenInfo, OUT PVOID Buffer, IN COORD ReadCoord, IN ULONG StringType, IN OUT PULONG NumRecords)
NTSTATUS InitializeScrollBuffer (VOID)
NTSTATUS GetScreenBufferInformation (IN PSCREEN_INFORMATION ScreenInfo, OUT PCOORD Size, OUT PCOORD CursorPosition, OUT PCOORD ScrollPosition, OUT PWORD Attributes, OUT PCOORD CurrentWindowSize, OUT PCOORD MaximumWindowSize)
VOID GetWindowLimits (IN PSCREEN_INFORMATION ScreenInfo, OUT PWINDOW_LIMITS WindowLimits)
NTSTATUS ResizeWindow (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT WindowDimensions, IN BOOL DoScrollBarUpdate)
NTSTATUS ResizeScreenBuffer (IN PSCREEN_INFORMATION ScreenInfo, IN COORD NewScreenSize, IN BOOL DoScrollBarUpdate)
NTSTATUS ScrollRegion (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT ScrollRectangle, IN PSMALL_RECT ClipRectangle OPTIONAL, IN COORD DestinationOrigin, IN CHAR_INFO Fill)
NTSTATUS SetWindowOrigin (IN PSCREEN_INFORMATION ScreenInfo, IN BOOLEAN Absolute, IN OUT COORD WindowOrigin)
VOID SetWindowSize (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS SetActiveScreenBuffer (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS QueueConsoleMessage (PCONSOLE_INFORMATION Console, UINT Message, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY ConsoleWindowProc (HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
VOID VerticalScroll (IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo, IN WORD ScrollCommand, IN WORD AbsoluteChange)
VOID HorizontalScroll (IN PSCREEN_INFORMATION ScreenInfo, IN WORD ScrollCommand, IN WORD AbsoluteChange)
VOID StreamScrollRegion (IN PSCREEN_INFORMATION ScreenInfo)
VOID ReadRectFromScreenBuffer (IN PSCREEN_INFORMATION ScreenInfo, IN COORD SourcePoint, IN PCHAR_INFO Target, IN COORD TargetSize, IN PSMALL_RECT TargetRect)
VOID InitializeThreadMessages (VOID)
NTSTATUS QueueThreadMessage (DWORD dwThreadId, UINT Message, WPARAM wParam, LPARAM lParam)
BOOL UnqueueThreadMessage (DWORD dwThreadId, UINT *pMessage, WPARAM *pwParam, LPARAM *plParam)
UINT ConsoleDragQueryFile (IN HANDLE hDrop, IN PVOID lpFile, IN UINT cb)
VOID DoDrop (IN WPARAM wParam, IN PCONSOLE_INFORMATION Console)
NTSTATUS ReadBuffer (IN PINPUT_INFORMATION InputInformation, OUT PVOID Buffer, IN ULONG Length, OUT PULONG EventsRead, IN BOOL Peek, IN BOOL StreamRead, OUT PBOOL ResetWaitEvent, IN BOOLEAN Unicode)
VOID ConsoleInputThread (IN PINPUT_THREAD_INIT_INFO pInputThreadInitInfo)
VOID StoreKeyInfo (IN PMSG msg)
VOID RetrieveKeyInfo (IN HWND hWnd, OUT PWORD pwVirtualKeyCode, OUT PWORD pwVirtualScanCode, IN BOOL FreeKeyInfo)
VOID ClearKeyInfo (IN HWND hWnd)
NTSTATUS ReadInputBuffer (IN PINPUT_INFORMATION InputInformation, OUT PINPUT_RECORD lpBuffer, IN OUT PDWORD nLength, IN BOOL Peek, IN BOOL WaitForData, IN BOOL StreamRead, IN PCONSOLE_INFORMATION Console, IN PHANDLE_DATA HandleData OPTIONAL, IN PCSR_API_MSG Message OPTIONAL, IN CSR_WAIT_ROUTINE WaitRoutine OPTIONAL, IN PVOID WaitParameter OPTIONAL, IN ULONG WaitParameterLength OPTIONAL, IN BOOLEAN WaitBlockExists OPTIONAL)
DWORD WriteInputBuffer (PCONSOLE_INFORMATION Console, PINPUT_INFORMATION InputBufferInformation, PINPUT_RECORD lpBuffer, DWORD nLength)
DWORD PrependInputBuffer (PCONSOLE_INFORMATION Console, PINPUT_INFORMATION InputBufferInformation, PINPUT_RECORD lpBuffer, DWORD nLength)
NTSTATUS CreateInputBuffer (IN ULONG NumberOfEvents OPTIONAL, IN PINPUT_INFORMATION InputBufferInformation)
NTSTATUS ReinitializeInputBuffer (OUT PINPUT_INFORMATION InputBufferInformation)
VOID FreeInputBuffer (IN PINPUT_INFORMATION InputBufferInformation)
NTSTATUS GetNumberOfReadyEvents (IN PINPUT_INFORMATION InputInformation, OUT PULONG NumberOfEvents)
NTSTATUS FlushInputBuffer (IN PINPUT_INFORMATION InputInformation)
NTSTATUS FlushAllButKeys (PINPUT_INFORMATION InputInformation)
NTSTATUS SetInputBufferSize (IN PINPUT_INFORMATION InputInformation, IN ULONG Size)
BOOL HandleSysKeyEvent (IN PCONSOLE_INFORMATION Console, IN HWND hWnd, IN UINT Message, IN WPARAM wParam, IN LPARAM lParam)
VOID HandleKeyEvent (IN PCONSOLE_INFORMATION Console, IN HWND hWnd, IN UINT Message, IN WPARAM wParam, IN LPARAM lParam)
BOOL HandleMouseEvent (IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo, IN UINT Message, IN WPARAM wParam, IN LPARAM lParam)
VOID HandleMenuEvent (IN PCONSOLE_INFORMATION Console, IN DWORD wParam)
VOID HandleFocusEvent (IN PCONSOLE_INFORMATION Console, IN BOOL bSetFocus)
VOID HandleCtrlEvent (IN PCONSOLE_INFORMATION Console, IN DWORD EventType)
int CreateCtrlThread (IN PCONSOLE_PROCESS_TERMINATION_RECORD ProcessHandleList, IN ULONG ProcessHandleListLength, IN PWCHAR Title, IN DWORD EventType, IN BOOL fForce)
VOID UnlockConsole (IN PCONSOLE_INFORMATION Console)
ULONG ShutdownConsole (IN HANDLE ConsoleHandle, IN DWORD dwFlags)
DWORD GetLinkProperties (LPWSTR pszLinkName, LPVOID lpvBuffer, UINT cb)
DWORD GetTitleFromLinkName (IN LPWSTR szLinkName, OUT LPWSTR szTitle)
VOID InitializeFonts (VOID)
BOOL InitializeCustomCP (VOID)
NTSTATUS EnumerateFonts (DWORD Flags)
VOID InitializeMouseButtons (VOID)
NTSTATUS GetMouseButtons (PULONG NumButtons)
NTSTATUS FindTextBufferFontInfo (IN PSCREEN_INFORMATION ScreenInfo, IN UINT CodePage, OUT PTEXT_BUFFER_FONT_INFO TextFontInfo)
NTSTATUS StoreTextBufferFontInfo (IN PSCREEN_INFORMATION ScreenInfo, IN ULONG FontIndex, IN COORD FontSize, IN BYTE FontFamily, IN LONG FontWeight, IN LPWSTR FaceName, IN UINT CodePage)
NTSTATUS RemoveTextBufferFontInfo (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS GetNumFonts (OUT PULONG NumberOfFonts)
NTSTATUS GetAvailableFonts (IN PSCREEN_INFORMATION ScreenInfo, IN BOOLEAN MaximumWindow, OUT PVOID Buffer, IN OUT PULONG NumFonts)
NTSTATUS GetFontSize (IN DWORD FontIndex, OUT PCOORD FontSize)
NTSTATUS GetCurrentFont (IN PSCREEN_INFORMATION ScreenInfo, IN BOOLEAN MaximumWindow, OUT PULONG FontIndex, OUT PCOORD FontSize)
NTSTATUS SetFont (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS SetScreenBufferFont (IN PSCREEN_INFORMATION ScreenInfo, IN ULONG FontIndex)
int ConvertToOem (IN UINT Codepage, IN LPWSTR Source, IN int SourceLength, OUT LPSTR Target, IN int TargetLength)
int ConvertInputToUnicode (IN UINT Codepage, IN LPSTR Source, IN int SourceLength, OUT LPWSTR Target, IN int TargetLength)
WCHAR CharToWcharGlyph (IN UINT Codepage, IN char Ch)
WCHAR CharToWchar (IN UINT Codepage, IN char Ch)
char WcharToChar (IN UINT Codepage, IN WCHAR Wchar)
int ConvertOutputToUnicode (IN UINT Codepage, IN LPSTR Source, IN int SourceLength, OUT LPWSTR Target, IN int TargetLength)
int ConvertOutputToOem (IN UINT Codepage, IN LPWSTR Source, IN int SourceLength, OUT LPSTR Target, IN int TargetLength)
NTSTATUS RealUnicodeToFalseUnicode (IN OUT LPWSTR Source, IN int SourceLength, IN UINT Codepage)
NTSTATUS FalseUnicodeToRealUnicode (IN OUT LPWSTR Source, IN int SourceLength, IN UINT Codepage)
VOID InitializeSubst (VOID)
VOID ShutdownSubst (VOID)
ULONG SrvConsoleSubst (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
BOOL DoFontEnum (IN HDC hDC OPTIONAL, IN LPWSTR pwszFace OPTIONAL, IN SHORT TTPointSize)
ULONG SrvGetConsoleInput (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvWriteConsoleInput (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvReadConsoleOutput (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvWriteConsoleOutput (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvReadConsoleOutputString (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvWriteConsoleOutputString (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvFillConsoleOutput (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvCreateConsoleScreenBuffer (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS TranslateOutputToPaddingUnicode (IN PCONSOLE_INFORMATION Console, IN OUT PCHAR_INFO OutputBuffer, IN COORD Size, IN OUT PCHAR_INFO OutputBufferR)
ULONG SrvGetConsoleMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleNumberOfFonts (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleNumberOfInputEvents (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetLargestConsoleWindowSize (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleScreenBufferInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleCursorInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleMouseInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleFontInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleFontSize (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleCurrentFont (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGenerateConsoleCtrlEvent (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleActiveScreenBuffer (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvFlushConsoleInputBuffer (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleScreenBufferSize (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleCursorPosition (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleCursorInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleWindowInfo (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvScrollConsoleScreenBuffer (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleTextAttribute (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleFont (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleIcon (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS SetScreenColors (IN PSCREEN_INFORMATION ScreenInfo, IN WORD Attributes, IN WORD PopupAttributes, IN BOOL UpdateWholeScreen)
ULONG SrvSetConsoleCP (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleCP (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleKeyboardLayoutName (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleWindow (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS CookedRead (IN PCOOKED_READ_DATA CookedReadData, IN PCSR_API_MSG WaitReplyMessage, IN PCSR_THREAD WaitingThread, IN BOOLEAN WaitRoutine)
NTSTATUS ReadChars (IN PINPUT_INFORMATION InputInfo, IN PCONSOLE_INFORMATION Console, IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN PSCREEN_INFORMATION ScreenInfo, IN OUT PWCHAR lpBuffer, IN OUT PDWORD NumBytes, IN DWORD InitialNumBytes, IN DWORD CtrlWakeupMask, IN PHANDLE_DATA HandleData, IN PCOMMAND_HISTORY CommandHistory, IN PCSR_API_MSG Message OPTIONAL, IN HANDLE HandleIndex, IN USHORT ExeNameLength, IN PWCHAR ExeName, IN BOOLEAN Unicode)
ULONG SrvOpenConsole (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvReadConsole (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvWriteConsole (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvDuplicateHandle (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetHandleInformation (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetHandleInformation (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID UnblockWriteConsole (IN PCONSOLE_INFORMATION Console, IN DWORD Reason)
NTSTATUS CloseInputHandle (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN PCONSOLE_INFORMATION Console, IN PHANDLE_DATA HandleData, IN HANDLE Handle)
NTSTATUS CloseOutputHandle (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN PCONSOLE_INFORMATION Console, IN PHANDLE_DATA HandleData, IN HANDLE Handle, IN BOOLEAN FreeHandle)
ULONG SrvCloseHandle (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID MakeCursorVisible (IN PSCREEN_INFORMATION ScreenInfo, IN COORD CursorPosition)
NTSTATUS SetCursorInformation (PSCREEN_INFORMATION ScreenInfo, ULONG Size, BOOLEAN Visible)
NTSTATUS SetCursorPosition (IN OUT PSCREEN_INFORMATION ScreenInfo, IN COORD Position, IN BOOL TurnOn)
NTSTATUS SetCursorMode (PSCREEN_INFORMATION ScreenInfo, BOOLEAN DoubleCursor)
VOID CursorTimerRoutine (IN PSCREEN_INFORMATION ScreenInfo)
VOID ConsoleHideCursor (IN PSCREEN_INFORMATION ScreenInfo)
VOID ConsoleShowCursor (IN PSCREEN_INFORMATION ScreenInfo)
VOID InitializeConsoleCommandData (IN PCONSOLE_INFORMATION Console)
ULONG SrvAddConsoleAlias (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleAlias (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleAliasesLength (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleAliasExesLength (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleAliases (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleAliasExes (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvExpungeConsoleCommandHistory (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvSetConsoleNumberOfCommands (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleCommandHistoryLength (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvGetConsoleCommandHistory (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
DWORD SrvSetConsoleCommandHistoryMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS MatchandCopyAlias (IN PCONSOLE_INFORMATION Console, IN PWCHAR Source, IN USHORT SourceLength, OUT PWCHAR TargetBuffer, IN OUT PUSHORT TargetLength, IN LPWSTR Exe, IN USHORT ExeLength, OUT PDWORD LineCount)
NTSTATUS AddCommand (IN PCOMMAND_HISTORY CommandHistory, IN PWCHAR Command, IN USHORT Length, IN BOOL HistoryNoDup)
NTSTATUS RetrieveCommand (IN PCOMMAND_HISTORY CommandHistory, IN WORD VirtualKeyCode, IN PWCHAR Buffer, IN ULONG BufferSize, OUT PULONG CommandSize)
PCOMMAND_HISTORY AllocateCommandHistory (IN PCONSOLE_INFORMATION Console, IN DWORD AppNameLength, IN PWCHAR AppName, IN HANDLE ProcessHandle)
VOID ResetCommandHistory (IN PCOMMAND_HISTORY CommandHistory)
ULONG SrvGetConsoleTitle (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleTitle (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID FreeAliasBuffers (IN PCONSOLE_INFORMATION Console)
VOID FreeCommandHistory (IN PCONSOLE_INFORMATION Console, IN HANDLE ProcessHandle)
VOID FreeCommandHistoryBuffers (IN OUT PCONSOLE_INFORMATION Console)
VOID ResizeCommandHistoryBuffers (IN PCONSOLE_INFORMATION Console, IN UINT NumCommands)
int MyStringCompareW (IN LPWSTR Str1, IN LPWSTR Str2, IN USHORT Length, IN BOOLEAN bCaseInsensitive)
int LoadStringExW (IN HINSTANCE hModule, IN UINT wID, OUT LPWSTR lpBuffer, IN int cchBufferMax, IN WORD wLangId)
ULONG SrvAllocConsole (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvFreeConsole (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS RemoveConsole (IN PCONSOLE_PER_PROCESS_DATA ProcessData, IN HANDLE ProcessHandle, IN HANDLE ProcessId)
BOOL MapHandle (IN HANDLE ClientProcessHandle, IN HANDLE ServerHandle, OUT PHANDLE ClientHandle)
VOID InitializeConsoleAttributes (VOID)
VOID GetRegistryValues (IN LPWSTR ConsoleTitle, OUT PCONSOLE_REGISTRY_INFO RegInfo)
LPWSTR TranslateConsoleTitle (LPWSTR ConsoleTitle, PUSHORT pcbTranslatedLength, BOOL Unexpand, BOOL Substitute)
NTSTATUS GetConsoleLangId (IN UINT OutputCP, OUT LANGID *pLangId)
ULONG SrvGetConsoleLangId (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS CreateConsoleBitmap (IN OUT PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsInfo, IN OUT PSCREEN_INFORMATION ScreenInfo, OUT PVOID *lpBitmap, OUT HANDLE *hMutex)
NTSTATUS WriteRegionToScreenBitMap (IN PSCREEN_INFORMATION ScreenInfo, IN PSMALL_RECT Region)
ULONG SrvInvalidateBitMapRect (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvVDMConsoleOperation (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID UpdateMousePosition (PSCREEN_INFORMATION ScreenInfo, COORD Position)
ULONG SrvSetConsoleCursor (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvShowConsoleCursor (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvConsoleMenuControl (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsolePalette (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleDisplayMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID SetActivePalette (IN PSCREEN_INFORMATION ScreenInfo)
VOID UnsetActivePalette (IN PSCREEN_INFORMATION ScreenInfo)
ULONG SrvRegisterConsoleVDM (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS SrvConsoleNotifyLastClose (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleHardwareState (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleHardwareState (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvGetConsoleDisplayMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleMenuClose (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
ULONG SrvSetConsoleKeyShortcuts (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
BOOL InitializeFullScreen (VOID)
NTSTATUS ChangeDispSettings (PCONSOLE_INFORMATION Console, HWND hwnd, DWORD dwFlags)
VOID InitSystemMenu (IN PCONSOLE_INFORMATION Console)
VOID InitializeMenu (IN PCONSOLE_INFORMATION Console)
VOID SetWinText (IN PCONSOLE_INFORMATION Console, IN UINT wID, IN BOOL Add)
VOID PropertiesDlgShow (IN PCONSOLE_INFORMATION Console, IN BOOL fCurrent)
VOID PropertiesUpdate (IN PCONSOLE_INFORMATION Console, IN HANDLE hClientSection)
int FindCreateFont (DWORD Family, LPWSTR pwszTTFace, COORD Size, LONG Weight, UINT CodePage)
VOID DoCopy (IN PCONSOLE_INFORMATION Console)
VOID DoMark (IN PCONSOLE_INFORMATION Console)
VOID DoSelectAll (IN PCONSOLE_INFORMATION Console)
VOID DoStringPaste (IN PCONSOLE_INFORMATION Console, IN PWCHAR pwStr, IN UINT DataSize)
VOID DoPaste (IN PCONSOLE_INFORMATION Console)
VOID ExtendSelection (IN PCONSOLE_INFORMATION Console, IN COORD CursorPosition)
VOID ClearSelection (IN PCONSOLE_INFORMATION Console)
VOID StoreSelection (IN PCONSOLE_INFORMATION Console)
VOID InvertSelection (IN PCONSOLE_INFORMATION Console, BOOL Inverting)
BOOL MyInvert (IN PCONSOLE_INFORMATION Console, IN PSMALL_RECT SmallRect)
VOID ConvertToMouseSelect (IN PCONSOLE_INFORMATION Console, IN COORD MousePosition)
VOID DoScroll (IN PCONSOLE_INFORMATION Console)
VOID ClearScroll (IN PCONSOLE_INFORMATION Console)
BOOL SetConsoleReserveKeys (HWND hWnd, DWORD fsReserveKeys)
int APIENTRY GreGetDIBitsInternal (HDC hdc, HBITMAP hBitmap, UINT iStartScan, UINT cNumScan, LPBYTE pjBits, LPBITMAPINFO pBitsInfo, UINT iUsage, UINT cjMaxBits, UINT cjMaxInfo)

Variables

PWIN32HEAP pConHeap
DWORD dwConBaseTag


Define Documentation

#define ALIAS_TAG   2
 

Definition at line 64 of file consrv.h.

Referenced by AddAlias(), AddExeAliasList(), and ReplaceAlias().

#define BMP_TAG   1
 

Definition at line 63 of file consrv.h.

Referenced by CreateConsoleBitmap().

#define BUFFER_TAG   8
 

Definition at line 70 of file consrv.h.

Referenced by CreateInputBuffer(), PrependInputBuffer(), and SetInputBufferSize().

#define CON_FACENAME pCon   )     SCR_FACENAME((pCon)->CurrentScreenBuffer)
 

Definition at line 132 of file consrv.h.

Referenced by SrvCreateConsoleScreenBuffer().

#define CON_FAMILY pCon   )     SCR_FAMILY((pCon)->CurrentScreenBuffer)
 

Definition at line 130 of file consrv.h.

Referenced by SrvCreateConsoleScreenBuffer().

#define CON_FONTCODEPAGE pCon   )     SCR_FONTCODEPAGE((pCon)->CurrentScreenBuffer)
 

Definition at line 135 of file consrv.h.

Referenced by SrvCreateConsoleScreenBuffer().

#define CON_FONTNUMBER pCon   )     SCR_FONTNUMBER((pCon)->CurrentScreenBuffer)
 

Definition at line 131 of file consrv.h.

#define CON_FONTSIZE pCon   )     SCR_FONTSIZE((pCon)->CurrentScreenBuffer)
 

Definition at line 133 of file consrv.h.

Referenced by ExtendSelection(), and SrvCreateConsoleScreenBuffer().

#define CON_FONTWEIGHT pCon   )     SCR_FONTWEIGHT((pCon)->CurrentScreenBuffer)
 

Definition at line 134 of file consrv.h.

Referenced by SrvCreateConsoleScreenBuffer().

 
#define CONSOLE_IS_DBCS_ENABLED  )     (FALSE)
 

Definition at line 149 of file consrv.h.

Referenced by DoCreateScreenBuffer(), DoStringPaste(), EnumerateFonts(), FalseUnicodeToRealUnicode(), FindCreateFont(), FontEnum(), GetConsoleLangId(), ProcessCommandLine(), PropertiesDlgShow(), PropertiesUpdate(), RealUnicodeToFalseUnicode(), SB_TranslateOutputToOem(), SB_TranslateOutputToUnicode(), SrvInvalidateBitMapRect(), and SrvSetConsoleCP().

 
#define CONSOLE_IS_IME_ENABLED  )     (FALSE)
 

Definition at line 150 of file consrv.h.

Referenced by ConsoleInputThread(), ConsoleWindowProc(), CreateWindowsWindow(), DestroyWindowsWindow(), DialogHookProc(), HandleKeyEvent(), ResizeScreenBuffer(), and SetUpConsole().

#define CONSOLE_MAX_FONT_NAME_LENGTH   256
 

Definition at line 55 of file consrv.h.

Referenced by InitializeFonts().

#define CONSOLE_SHUTDOWN_FAILED   0
 

Definition at line 870 of file consrv.h.

Referenced by CreateCtrlThread(), and ProcessCtrlEvents().

#define CONSOLE_SHUTDOWN_SUCCEEDED   1
 

Definition at line 871 of file consrv.h.

Referenced by CreateCtrlThread(), and UnlockConsole().

#define CONSOLE_SHUTDOWN_SYSTEM   2
 

Definition at line 872 of file consrv.h.

Referenced by CreateCtrlThread(), and UnlockConsole().

#define CONSOLE_TAG   6
 

Definition at line 68 of file consrv.h.

Referenced by AllocateConsole().

#define ConsoleHeapAlloc Flags,
Size   )     Win32HeapAlloc(pConHeap, Size, Flags, Flags)
 

Definition at line 180 of file consrv.h.

Referenced by AddAlias(), AddCommand(), AddExeAliasList(), AddFaceNode(), AllocateCommandHistory(), AllocateConsole(), AllocateScrollBuffer(), BeginPopup(), ConsoleAddProcessRoutine(), ConsoleClientConnectRoutine(), ConvertOutputToOem(), ConvertOutputToUnicode(), CookedRead(), CreateConsoleBitmap(), CreateDbcsScreenBuffer(), CreateInputBuffer(), CreateScreenBuffer(), DoStringPaste(), DrawCommandListPopup(), EnumerateFonts(), FalseUnicodeToRealUnicode(), FE_WriteRegionToScreenHW(), FindExe(), FindExeCommandHistory(), FlushAllButKeys(), GrowConsoleHandleTable(), GrowIoHandleTable(), InheritIoHandleTable(), InitializeInputHandle(), InitializeScrollBuffer(), LoadLink(), MatchandCopyAlias(), MergeAttrStrings(), MyRegQueryValue(), PrependInputBuffer(), ProcessCommandListInput(), ProcessCtrlEvents(), QueueConsoleMessage(), QueueThreadMessage(), RawReadWaitRoutine(), ReadChars(), ReadOutputString(), ReadString(), ReallocCommandHistory(), RealUnicodeToFalseUnicode(), ReCreateDbcsScreenBuffer(), ReplaceAlias(), ResizeScreenBuffer(), SetInputBufferSize(), SetRAMFont(), SetRAMFontCodePage(), SrvAddConsoleAlias(), SrvAllocConsole(), SrvGetConsoleAlias(), SrvSetConsoleTitle(), SrvVDMConsoleOperation(), SrvWriteConsoleOutput(), StoreSelection(), StoreTextBufferFontInfo(), TranslateConsoleTitle(), UpdateComplexRegion(), WaitForMoreToRead(), WWSB_DoSrvWriteConsole(), WWSB_DoWriteConsole(), WWSB_WriteChars(), WWSB_WriteOutputString(), WWSB_WriteRectToScreenBuffer(), and WWSB_WriteRegionToScreen().

#define ConsoleHeapFree Address   ) 
 

Value:

{ \ Win32HeapFree(pConHeap, Address); \ }

Definition at line 193 of file consrv.h.

Referenced by AbortCreateConsole(), AddAlias(), AddCommand(), AddExeAliasList(), AllocateCommandHistory(), AllocateConsole(), BeginPopup(), CloseInputHandle(), ConsoleAddProcessRoutine(), ConsoleClientConnectRoutine(), ConvertOutputToOem(), ConvertOutputToUnicode(), CookedRead(), CookedReadWaitRoutine(), CreateConsoleBitmap(), CreateDbcsScreenBuffer(), CreateInputBuffer(), CreateScreenBuffer(), DeleteDbcsScreenBuffer(), DestroyConsole(), DestroyWindowsWindow(), DirectReadWaitRoutine(), DoStringPaste(), DrawCommandListPopup(), EmptyCommandHistory(), EndPopup(), FalseUnicodeToRealUnicode(), FE_StreamWriteToScreenBuffer(), FE_WriteRegionToScreenHW(), FindExe(), FindExeCommandHistory(), FlushAllButKeys(), FreeAliasList(), FreeCommandHistoryBuffers(), FreeConsoleBitmap(), FreeInputBuffer(), FreeInputHandle(), FreeProcessData(), FreeScreenBuffer(), FreeScrollBuffer(), GetLinkProperties(), GetRegistryValues(), GrowConsoleHandleTable(), GrowIoHandleTable(), InheritIoHandleTable(), InitializeInputHandle(), InitializeIoHandleTable(), InitializeScrollBuffer(), MatchandCopyAlias(), MergeAttrStrings(), MyRegQueryValue(), PrependInputBuffer(), ProcessCommandListInput(), ProcessCtrlEvents(), QueueConsoleMessage(), QueueThreadMessage(), RawReadWaitRoutine(), ReadChars(), ReadOutputString(), ReallocCommandHistory(), RealUnicodeToFalseUnicode(), ReCreateDbcsScreenBuffer(), RemoveAlias(), RemoveConsole(), RemoveProcessFromList(), RemoveTextBufferFontInfo(), ReplaceAlias(), ResizeScreenBuffer(), SetInputBufferSize(), SetRAMFont(), SetRAMFontCodePage(), SrvAddConsoleAlias(), SrvAllocConsole(), SrvGetConsoleAlias(), SrvSetConsoleTitle(), SrvVDMConsoleOperation(), SrvWriteConsoleOutput(), StoreSelection(), StreamScrollRegion(), UnqueueConsoleMessage(), UnqueueThreadMessage(), UpdateComplexRegion(), WaitForMoreToRead(), WriteConsoleWaitRoutine(), WWSB_DoSrvWriteConsole(), WWSB_DoWriteConsole(), WWSB_FillOutput(), WWSB_FillRectangle(), WWSB_WriteChars(), WWSB_WriteOutputString(), WWSB_WriteRectToScreenBuffer(), and WWSB_WriteRegionToScreen().

#define ConsoleHeapReAlloc Flags,
Address,
Size   )     Win32HeapReAlloc(pConHeap, Address, Size, Flags)
 

Definition at line 183 of file consrv.h.

Referenced by FontEnum(), LoadLink(), and ResizeScreenBuffer().

#define ConsoleHeapSize Address   )     Win32HeapSize(pConHeap, Address)
 

Definition at line 199 of file consrv.h.

Referenced by SetRAMFont(), SetRAMFontCodePage(), SrvVDMConsoleOperation(), and StoreSelection().

#define ConvertAttrToRGB Con,
Attr   )     ((Con)->ColorTable[(Attr) & 0x0F])
 

Definition at line 264 of file consrv.h.

Referenced by SetFont(), SetScreenColors(), WWSB_ConsolePolyTextOut(), and WWSB_WriteRegionToScreen().

#define DATA_CHUNK_SIZE   8192
 

Definition at line 57 of file consrv.h.

Referenced by DoStringPaste().

#define DBGCHARS _params_   ) 
 

Definition at line 40 of file consrv.h.

Referenced by CharToWchar(), CharToWcharGlyph(), ConvertInputToUnicode(), ConvertOutputToOem(), ConvertOutputToUnicode(), ConvertToFullScreen(), ConvertToOem(), ConvertToWindowed(), FalseUnicodeToRealUnicode(), FE_TranslateOutputToAnsiUnicodeInternal(), InitializeFullScreen(), RealUnicodeToFalseUnicode(), SB_TranslateOutputToAnsiUnicode(), SB_TranslateOutputToOem(), SB_TranslateOutputToOemUnicode(), SB_TranslateOutputToUnicode(), SetScreenBufferFont(), TranslateInputToOem(), TranslateInputToUnicode(), WcharToChar(), and WWSB_DoSrvWriteConsole().

#define DBGFONTS _params_   ) 
 

Definition at line 38 of file consrv.h.

Referenced by CreateScreenBuffer(), DoFontEnum(), EnumerateFonts(), FindCreateFont(), FontEnum(), and SetScreenBufferFont().

#define DBGFONTS2 _params_   ) 
 

Definition at line 39 of file consrv.h.

Referenced by FontEnum().

#define DBGFULLSCR _params_   ) 
 

Definition at line 42 of file consrv.h.

Referenced by ConnectToEmulator().

#define DBGOUTPUT _params_   ) 
 

Definition at line 41 of file consrv.h.

Referenced by CopyRectangle(), CreateScreenBuffer(), FE_StreamWriteToScreenBuffer(), ReadOutputString(), ReadRectFromScreenBuffer(), ReadScreenBuffer(), ScrollScreen(), SrvCreateConsoleScreenBuffer(), SrvReadConsoleOutput(), SrvWriteConsoleOutput(), WriteScreenBuffer(), WWSB_DoSrvWriteConsole(), WWSB_FillOutput(), WWSB_FillRectangle(), WWSB_WriteOutputString(), WWSB_WriteRectToScreenBuffer(), WWSB_WriteRegionToScreen(), and WWSB_WriteToScreen().

#define DBGPRINT _params_   ) 
 

Definition at line 43 of file consrv.h.

#define EF_DEFFACE   0x0020
 

Definition at line 930 of file consrv.h.

Referenced by ConsoleInputThread(), df(), and EnumerateFonts().

#define EF_ENUMERATED   0x0004
 

Definition at line 927 of file consrv.h.

Referenced by df(), and EnumerateFonts().

#define EF_NEW   0x0001
 

Definition at line 925 of file consrv.h.

Referenced by df(), and EnumerateFonts().

#define EF_OEMFONT   0x0008
 

Definition at line 928 of file consrv.h.

Referenced by df(), EnumerateFonts(), and FontEnum().

#define EF_OLD   0x0002
 

Definition at line 926 of file consrv.h.

Referenced by df(), and EnumerateFonts().

#define EF_TTFONT   0x0010
 

Definition at line 929 of file consrv.h.

Referenced by df(), EnumerateFonts(), and FontEnum().

#define FONT_TAG   10
 

Definition at line 72 of file consrv.h.

Referenced by AddFaceNode(), EnumerateFonts(), FontEnum(), and StoreTextBufferFontInfo().

#define GetWindowConsole hWnd   )     (PCONSOLE_INFORMATION)GetWindowLongPtr((hWnd), GWLP_USERDATA)
 

Definition at line 83 of file consrv.h.

Referenced by ConsoleWindowProc().

#define HANDLE_TAG   5
 

Definition at line 67 of file consrv.h.

Referenced by ConsoleAddProcessRoutine(), ConsoleClientConnectRoutine(), GrowConsoleHandleTable(), GrowIoHandleTable(), InheritIoHandleTable(), InitializeInputHandle(), and SrvAllocConsole().

#define HISTORY_TAG   3
 

Definition at line 65 of file consrv.h.

Referenced by AddCommand(), AllocateCommandHistory(), ReadChars(), and ReallocCommandHistory().

#define ICON_TAG   7
 

Definition at line 69 of file consrv.h.

#define LINK_FULLINFO   2
 

Definition at line 900 of file consrv.h.

Referenced by GetLinkProperties().

#define LINK_NOINFO   0
 

Definition at line 898 of file consrv.h.

Referenced by GetLinkProperties(), and LoadLinkInfo().

#define LINK_SIMPLEINFO   1
 

Definition at line 899 of file consrv.h.

Referenced by GetLinkProperties(), and LoadLinkInfo().

#define LoadStringEx   LoadStringExA
 

Definition at line 157 of file consrv.h.

Referenced by CommandNumberPopup(), CopyFromCharPopup(), and CopyToCharPopup().

#define LockConsole Con   )     RtlEnterCriticalSection(&(Con)->ConsoleLock)
 

Definition at line 260 of file consrv.h.

Referenced by ConsoleWindowProc(), PropertiesDlgShow(), ReadInputBuffer(), and RevalidateConsole().

 
#define LockConsoleHandleTable  )     RtlEnterCriticalSection(&ConsoleHandleLock)
 

Definition at line 258 of file consrv.h.

Referenced by DestroyConsole(), RevalidateConsole(), SetUpConsole(), and WriteConsoleWaitRoutine().

#define MAKE_TAG  )     (RTL_HEAP_MAKE_TAG( dwConBaseTag, t ))
 

Definition at line 60 of file consrv.h.

#define NELEM array   )     (sizeof(array)/sizeof(array[0]))
 

Definition at line 101 of file consrv.h.

#define SCREEN_BUFFER_POINTER X,
Y,
XSIZE,
CELLSIZE   )     (((XSIZE * (Y)) + (X)) * (ULONG)CELLSIZE)
 

Definition at line 2003 of file consrv.h.

#define SCREEN_TAG   11
 

Definition at line 73 of file consrv.h.

Referenced by AllocateScrollBuffer(), CreateScreenBuffer(), InitializeScrollBuffer(), MergeAttrStrings(), and ResizeScreenBuffer().

#define SetConsoleBkColor hw,
clr   )     SetWindowLong(hw, GWL_CONSOLE_BKCOLOR, clr)
 

Definition at line 93 of file consrv.h.

Referenced by SetScreenColors().

#define SetConsolePid hw,
pid   )     SetWindowLong(hw, GWL_CONSOLE_PID, pid)
 

Definition at line 94 of file consrv.h.

Referenced by CreateWindowsWindow().

#define SetConsoleTid hw,
tid   )     SetWindowLong(hw, GWL_CONSOLE_TID, tid)
 

Definition at line 95 of file consrv.h.

Referenced by CreateWindowsWindow().

#define TITLE_TAG   4
 

Definition at line 66 of file consrv.h.

Referenced by AllocateConsole(), ProcessCtrlEvents(), SrvSetConsoleTitle(), and TranslateConsoleTitle().

#define TMP_TAG   0
 

Definition at line 62 of file consrv.h.

Referenced by BeginPopup(), ConsoleClientConnectRoutine(), ConvertOutputToOem(), ConvertOutputToUnicode(), CookedRead(), DoStringPaste(), FalseUnicodeToRealUnicode(), FE_WriteRegionToScreenHW(), FindExe(), FindExeCommandHistory(), FlushAllButKeys(), MatchandCopyAlias(), MyRegQueryValue(), ProcessCommandListInput(), ProcessCtrlEvents(), QueueConsoleMessage(), QueueThreadMessage(), RawReadWaitRoutine(), ReadChars(), ReadOutputString(), RealUnicodeToFalseUnicode(), SrvAddConsoleAlias(), SrvGetConsoleAlias(), SrvWriteConsoleOutput(), StoreSelection(), UpdateComplexRegion(), WWSB_DoSrvWriteConsole(), WWSB_DoWriteConsole(), WWSB_WriteChars(), WWSB_WriteOutputString(), and WWSB_WriteRectToScreenBuffer().

 
#define UnlockConsoleHandleTable  )     RtlLeaveCriticalSection(&ConsoleHandleLock)
 

Definition at line 259 of file consrv.h.

Referenced by DestroyConsole(), RevalidateConsole(), SetUpConsole(), and WriteConsoleWaitRoutine().

 
#define ValidateConsoleHeap  ) 
 

Value:

if (NtCurrentPeb()->BeingDebugged) { \ RtlValidateHeap(Win32HeapGetHandle(pConHeap), 0, NULL); \ }

Definition at line 171 of file consrv.h.

#define W32PF_ALLOWSETFOREGROUND   0x00080000
 

Definition at line 2268 of file consrv.h.

Referenced by CanForceForeground(), CheckAllowForeground(), and SetProcessForegroundRights().

#define W32PF_CONSOLEHASFOCUS   0x04000000
 

Definition at line 2269 of file consrv.h.

Referenced by _GetGUIThreadInfo(), and SetProcessForegroundRights().

#define WAIT_TAG   9
 

Definition at line 71 of file consrv.h.

Referenced by WaitForMoreToRead().


Typedef Documentation

typedef struct tagFACENODE FACENODE
 

Referenced by df().

typedef struct tagFACENODE * PFACENODE
 

Referenced by df().


Function Documentation

VOID AbortCreateConsole IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 4423 of file output.c.

References ConsoleHeapFree, DestroyConsole(), DestroyFontCache(), FreeAliasBuffers(), FreeCommandHistoryBuffers(), FreeInputBuffer(), FreeLocalEUDC(), INITIALIZATION_FAILED, INITIALIZATION_SUCCEEDED, NtClose(), NtSetEvent(), and NULL.

Referenced by FreeCon().

04426 { 04427 // 04428 // Signal any process waiting for us that initialization failed 04429 // 04430 04431 NtSetEvent(Console->InitEvents[INITIALIZATION_FAILED],NULL); 04432 04433 // 04434 // Now clean up the console structure 04435 // 04436 04437 CloseHandle(Console->ClientThreadHandle); 04438 FreeInputBuffer(&Console->InputBuffer); 04439 ConsoleHeapFree(Console->Title); 04440 ConsoleHeapFree(Console->OriginalTitle); 04441 NtClose(Console->InitEvents[INITIALIZATION_SUCCEEDED]); 04442 NtClose(Console->InitEvents[INITIALIZATION_FAILED]); 04443 NtClose(Console->TerminationEvent); 04444 FreeAliasBuffers(Console); 04445 FreeCommandHistoryBuffers(Console); 04446 #if defined(FE_SB) 04447 FreeLocalEUDC(Console); 04448 DestroyFontCache(Console->FontCacheInformation); 04449 #endif 04450 DestroyConsole(Console); 04451 }

NTSTATUS AddCommand IN PCOMMAND_HISTORY  CommandHistory,
IN PWCHAR  Command,
IN USHORT  Length,
IN BOOL  HistoryNoDup
 

Definition at line 4744 of file server/cmdline.c.

References ASSERT, CLE_ALLOCATED, CLE_RESET, COMMAND, COMMAND_IND_INC, COMMAND_IND_PREV, ConsoleHeapAlloc, ConsoleHeapFree, FindMatchingCommand(), FMCFL_EXACT_MATCH, HISTORY_TAG, MAKE_TAG, NULL, RemoveCommand(), ResetCommandHistory(), and SHORT.

Referenced by CookedRead().

04750 { 04751 PCOMMAND *ppCmd; 04752 //PWCHAR LastChar; 04753 04754 // only add if doesn't match current command 04755 04756 if (CommandHistory == NULL || CommandHistory->MaximumNumberOfCommands == 0) { 04757 return STATUS_NO_MEMORY; 04758 } 04759 ASSERT(CommandHistory->Flags & CLE_ALLOCATED); 04760 04761 // 04762 // don't remove trailing blanks - prompt "asdf " won't work. 04763 // 04764 //LastChar=Command+(Length/sizeof(WCHAR))-1; 04765 //while (Length && *LastChar--==(WCHAR)' ') Length-=2; 04766 04767 if (Length == 0) { 04768 return STATUS_SUCCESS; 04769 } 04770 04771 if (CommandHistory->NumberOfCommands == 0 || 04772 CommandHistory->Commands[CommandHistory->LastAdded]->CommandLength != Length || 04773 memcmp(CommandHistory->Commands[CommandHistory->LastAdded]->Command,Command,Length)) { 04774 04775 PCOMMAND pCmdReuse = NULL; 04776 04777 if (HistoryNoDup) { 04778 SHORT i; 04779 i = FindMatchingCommand(CommandHistory, Command, Length, 04780 CommandHistory->LastDisplayed, FMCFL_EXACT_MATCH); 04781 if (i != -1) { 04782 pCmdReuse = RemoveCommand(CommandHistory, i); 04783 } 04784 } 04785 04786 04787 // 04788 // find free record. if all records are used, free the lru one. 04789 // 04790 04791 if (CommandHistory->NumberOfCommands < CommandHistory->MaximumNumberOfCommands) { 04792 CommandHistory->LastAdded += 1; 04793 CommandHistory->NumberOfCommands++; 04794 } 04795 else { 04796 COMMAND_IND_INC(CommandHistory->LastAdded, CommandHistory); 04797 COMMAND_IND_INC(CommandHistory->FirstCommand, CommandHistory); 04798 ConsoleHeapFree(CommandHistory->Commands[CommandHistory->LastAdded]); 04799 if (CommandHistory->LastDisplayed == CommandHistory->LastAdded) { 04800 CommandHistory->LastDisplayed = -1; 04801 } 04802 } 04803 04804 if (CommandHistory->LastDisplayed == -1 || 04805 CommandHistory->Commands[CommandHistory->LastDisplayed]->CommandLength != Length || 04806 memcmp(CommandHistory->Commands[CommandHistory->LastDisplayed]->Command,Command,Length)) { 04807 ResetCommandHistory(CommandHistory); 04808 } 04809 04810 // 04811 // add command to array 04812 // 04813 04814 ppCmd = &CommandHistory->Commands[CommandHistory->LastAdded]; 04815 if (pCmdReuse) { 04816 *ppCmd = pCmdReuse; 04817 } else { 04818 *ppCmd = (PCOMMAND)ConsoleHeapAlloc( MAKE_TAG(HISTORY_TAG), 04819 Length - sizeof(WCHAR) + sizeof(COMMAND)); 04820 if (*ppCmd == NULL) { 04821 COMMAND_IND_PREV(CommandHistory->LastAdded, CommandHistory); 04822 CommandHistory->NumberOfCommands -= 1; 04823 return STATUS_NO_MEMORY; 04824 } 04825 (*ppCmd)->CommandLength = Length; 04826 RtlCopyMemory((*ppCmd)->Command,Command,Length); 04827 } 04828 } 04829 CommandHistory->Flags |= CLE_RESET; // remember that we've returned a cmd 04830 return STATUS_SUCCESS; 04831 }

PCOMMAND_HISTORY AllocateCommandHistory IN PCONSOLE_INFORMATION  Console,
IN DWORD  AppNameLength,
IN PWCHAR  AppName,
IN HANDLE  ProcessHandle
 

Definition at line 1683 of file server/cmdline.c.

References ASSERT, BOOL, CLE_ALLOCATED, CLE_NO_POPUPS, ConsoleHeapAlloc, ConsoleHeapFree, DBGPRINT, FALSE, History, HISTORY_TAG, MAKE_TAG, my_wcsncmpi, NULL, SHORT, TRUE, and USHORT.

Referenced by ConsoleClientConnectRoutine(), and SrvAllocConsole().

01692 : 01693 01694 This routine returns the LRU command history buffer, or the command history 01695 buffer that corresponds to the app name. 01696 01697 Arguments: 01698 01699 Console - pointer to console. 01700 01701 Return Value: 01702 01703 Pointer to command history buffer. if none are available, returns NULL. 01704 01705 --*/ 01706 01707 { 01708 PCOMMAND_HISTORY History,BestCandidate; 01709 PLIST_ENTRY ListHead, ListNext; 01710 BOOL SameApp; 01711 01712 // 01713 // Reuse a history buffer. The buffer must be !CLE_ALLOCATED. 01714 // If possible, the buffer should have the same app name. 01715 // 01716 01717 ListHead = &Console->CommandHistoryList; 01718 ListNext = ListHead->Blink; 01719 BestCandidate = NULL; 01720 SameApp = FALSE; 01721 while (ListNext != ListHead) { 01722 History = CONTAINING_RECORD( ListNext, COMMAND_HISTORY, ListLink ); 01723 ListNext = ListNext->Blink; 01724 01725 if ((History->Flags & CLE_ALLOCATED) == 0) { 01726 01727 // 01728 // use LRU history buffer with same app name 01729 // 01730 01731 if (History->AppName && !my_wcsncmpi(History->AppName,AppName,(USHORT)AppNameLength)) { 01732 BestCandidate = History; 01733 SameApp = TRUE; 01734 break; 01735 } 01736 01737 // 01738 // second best choice is LRU history buffer 01739 // 01740 01741 if (BestCandidate == NULL) { 01742 BestCandidate = History; 01743 } 01744 } 01745 } 01746 01747 // 01748 // if there isn't a free buffer for the app name and the maximum number of 01749 // command history buffers hasn't been allocated, allocate a new one. 01750 // 01751 01752 if (!SameApp && Console->NumCommandHistories < Console->MaxCommandHistories) { 01753 History = (PCOMMAND_HISTORY)ConsoleHeapAlloc(MAKE_TAG( HISTORY_TAG ),sizeof(COMMAND_HISTORY) + ((Console->CommandHistorySize-1) * sizeof(PCOMMAND))); 01754 if (History == NULL) { 01755 return NULL; 01756 } 01757 History->AppName = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( HISTORY_TAG ),AppNameLength); 01758 if (History->AppName == NULL) { 01759 ConsoleHeapFree(History); 01760 return NULL; 01761 } 01762 RtlCopyMemory(History->AppName,AppName,AppNameLength); 01763 History->Flags = CLE_ALLOCATED; 01764 History->NumberOfCommands = 0; 01765 History->LastAdded = -1; 01766 History->LastDisplayed = -1; 01767 History->FirstCommand = 0; 01768 History->MaximumNumberOfCommands = Console->CommandHistorySize; 01769 InsertHeadList(&Console->CommandHistoryList,&History->ListLink); 01770 Console->NumCommandHistories+=1; 01771 History->ProcessHandle = ProcessHandle; 01772 InitializeListHead(&History->PopupList); 01773 return History; 01774 } 01775 01776 // 01777 // if the app name doesn't match, copy in the new app name and free the old commands. 01778 // 01779 01780 if (BestCandidate) { 01781 History = BestCandidate; 01782 ASSERT(CLE_NO_POPUPS(History)); 01783 if (!SameApp) { 01784 SHORT i; 01785 if (History->AppName) { 01786 DBGPRINT(("Reusing %ls command history\n", History->AppName)); 01787 ConsoleHeapFree(History->AppName); 01788 } 01789 for (i=0;i<History->NumberOfCommands;i++) { 01790 ConsoleHeapFree(History->Commands[i]); 01791 } 01792 History->NumberOfCommands = 0; 01793 History->LastAdded = -1; 01794 History->LastDisplayed = -1; 01795 History->FirstCommand = 0; 01796 History->AppName = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( HISTORY_TAG ),AppNameLength); 01797 if (History->AppName == NULL) { 01798 History->Flags &= ~CLE_ALLOCATED; 01799 return NULL; 01800 } 01801 RtlCopyMemory(History->AppName,AppName,AppNameLength); 01802 } 01803 History->ProcessHandle = ProcessHandle; 01804 History->Flags |= CLE_ALLOCATED; 01805 01806 // 01807 // move to the front of the list 01808 // 01809 01810 RemoveEntryList(&BestCandidate->ListLink); 01811 InsertHeadList(&Console->CommandHistoryList,&BestCandidate->ListLink); 01812 } 01813 return BestCandidate; 01814 }

NTSTATUS AllocateConsole IN HANDLE  ConsoleHandle,
IN LPWSTR  Title,
IN USHORT  TitleLength,
IN HANDLE  ClientProcessHandle,
OUT PHANDLE  StdIn,
OUT PHANDLE  StdOut,
OUT PHANDLE  StdErr,
OUT PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN OUT PCONSOLE_INFO  ConsoleInfo,
IN BOOLEAN  WindowVisible,
IN DWORD  ConsoleThreadId
 

Definition at line 789 of file w32/ntcon/server/handle.c.

References BOOL, CM_CREATE_CONSOLE_WINDOW, CONSOLE_CLIENTTHREADHANDLE, CONSOLE_NO_WINDOW, CONSOLE_TAG, ConsoleHandles, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleOutputCP, CreateEUDC(), CreateInputBuffer(), DoCreateScreenBuffer(), dwConsoleThreadId, FALSE, _CONSOLE_INFORMATION::Flags, FreeInputBuffer(), FreeScreenBuffer(), HorizontalClientToWindow, IndexFromHandle, INITIALIZATION_FAILED, INITIALIZATION_SUCCEEDED, InitializeConsoleCommandData(), InitializeIoHandleTable(), MAKE_TAG, MapHandle(), NT_SUCCESS, NtClose(), NtCreateEvent(), NtDuplicateObject(), NTSTATUS(), NULL, OEMCP, PostThreadMessage(), RtlDeleteCriticalSection(), RtlInitializeCriticalSection(), Status, TITLE_TAG, TranslateConsoleTitle(), TRUE, UnProtectHandle(), and VerticalClientToWindow.

Referenced by SetUpConsole().

00805 : 00806 00807 This routine allocates and initialized a console and its associated 00808 data - input buffer and screen buffer. 00809 00810 Arguments: 00811 00812 ConsoleHandle - Handle of console to allocate. 00813 00814 dwWindowSize - Initial size of screen buffer window, in rows and columns. 00815 00816 nFont - Initial number of font text is displayed in. 00817 00818 dwScreenBufferSize - Initial size of screen buffer, in rows and columns. 00819 00820 nInputBufferSize - Initial size of input buffer, in events. 00821 00822 dwWindowFlags - 00823 00824 StdIn - On return, contains handle to stdin. 00825 00826 StdOut - On return, contains handle to stdout. 00827 00828 StdErr - On return, contains handle to stderr. 00829 00830 ProcessData - On return, contains the initialized per-process data. 00831 00832 Return Value: 00833 00834 Note: 00835 00836 The console handle table lock must be held when calling this routine. 00837 00838 --*/ 00839 00840 { 00841 PCONSOLE_INFORMATION Console; 00842 NTSTATUS Status; 00843 BOOL Success; 00844 00845 // 00846 // allocate console data 00847 // 00848 00849 Console = (PCONSOLE_INFORMATION)ConsoleHeapAlloc( MAKE_TAG( CONSOLE_TAG ) | HEAP_ZERO_MEMORY, 00850 sizeof(CONSOLE_INFORMATION)); 00851 if (Console == NULL) { 00852 return STATUS_NO_MEMORY; 00853 } 00854 ConsoleHandles[IndexFromHandle(ConsoleHandle)] = Console; 00855 00856 Console->Flags = WindowVisible ? 0 : CONSOLE_NO_WINDOW; 00857 Console->hIcon = ConsoleInfo->hIcon; 00858 Console->hSmIcon = ConsoleInfo->hSmIcon; 00859 Console->iIconId = ConsoleInfo->iIconId; 00860 Console->dwHotKey = ConsoleInfo->dwHotKey; 00861 #if !defined(FE_SB) 00862 Console->CP = OEMCP; 00863 Console->OutputCP = ConsoleOutputCP; 00864 #endif 00865 Console->ReserveKeys = CONSOLE_NOSHORTCUTKEY; 00866 Console->ConsoleHandle = ConsoleHandle; 00867 Console->bIconInit = TRUE; 00868 Console->VerticalClientToWindow = VerticalClientToWindow; 00869 Console->HorizontalClientToWindow = HorizontalClientToWindow; 00870 #if defined(FE_SB) 00871 SetConsoleCPInfo(Console,TRUE); 00872 SetConsoleCPInfo(Console,FALSE); 00873 #endif 00874 00875 // 00876 // must wait for window to be destroyed or client impersonation won't 00877 // work. 00878 // 00879 00880 Status = NtDuplicateObject(NtCurrentProcess(), 00881 CONSOLE_CLIENTTHREADHANDLE(CSR_SERVER_QUERYCLIENTTHREAD()), 00882 NtCurrentProcess(), 00883 &Console->ClientThreadHandle, 00884 0, 00885 FALSE, 00886 DUPLICATE_SAME_ACCESS 00887 ); 00888 if (!NT_SUCCESS(Status)) { 00889 goto ErrorExit5; 00890 } 00891 00892 #if DBG 00893 // 00894 // Make sure the handle isn't protected so we can close it later 00895 // 00896 UnProtectHandle(Console->ClientThreadHandle); 00897 #endif // DBG 00898 00899 InitializeListHead(&Console->OutputQueue); 00900 InitializeListHead(&Console->ProcessHandleList); 00901 InitializeListHead(&Console->ExeAliasList); 00902 InitializeListHead(&Console->MessageQueue); 00903 00904 Status = NtCreateEvent(&Console->InitEvents[INITIALIZATION_SUCCEEDED], 00905 EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); 00906 if (!NT_SUCCESS(Status)) { 00907 goto ErrorExit4a; 00908 } 00909 Status = NtCreateEvent(&Console->InitEvents[INITIALIZATION_FAILED], 00910 EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); 00911 if (!NT_SUCCESS(Status)) { 00912 goto ErrorExit4; 00913 } 00914 Status = RtlInitializeCriticalSection(&Console->ConsoleLock); 00915 if (!NT_SUCCESS(Status)) { 00916 goto ErrorExit3a; 00917 } 00918 InitializeConsoleCommandData(Console); 00919 00920 // 00921 // initialize input buffer 00922 // 00923 00924 #if defined(FE_SB) 00925 Status = CreateInputBuffer(ConsoleInfo->nInputBufferSize, 00926 &Console->InputBuffer, 00927 Console); 00928 #else 00929 Status = CreateInputBuffer(ConsoleInfo->nInputBufferSize, 00930 &Console->InputBuffer); 00931 #endif 00932 if (!NT_SUCCESS(Status)) { 00933 goto ErrorExit3; 00934 } 00935 00936 Console->Title = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( TITLE_TAG ),TitleLength+sizeof(WCHAR)); 00937 if (Console->Title == NULL) { 00938 Status = STATUS_NO_MEMORY; 00939 goto ErrorExit2; 00940 } 00941 RtlCopyMemory(Console->Title,Title,TitleLength); 00942 Console->Title[TitleLength/sizeof(WCHAR)] = (WCHAR)0; // NULL terminate 00943 Console->TitleLength = TitleLength; 00944 00945 Console->OriginalTitle = TranslateConsoleTitle(Console->Title, &Console->OriginalTitleLength, TRUE, FALSE); 00946 if (Console->OriginalTitle == NULL) { 00947 Status = STATUS_NO_MEMORY; 00948 goto ErrorExit1; 00949 } 00950 00951 Status = NtCreateEvent(&Console->TerminationEvent, 00952 EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); 00953 if (!NT_SUCCESS(Status)) { 00954 goto ErrorExit1a; 00955 } 00956 00957 // 00958 // initialize screen buffer. we don't call OpenConsole to do this 00959 // because we need to specify the font, windowsize, etc. 00960 // 00961 00962 Status = DoCreateScreenBuffer(Console, 00963 ConsoleInfo); 00964 if (!NT_SUCCESS(Status)){ 00965 goto ErrorExit1b; 00966 } 00967 00968 00969 Console->CurrentScreenBuffer = Console->ScreenBuffers; 00970 #if defined(FE_SB) 00971 #if defined(FE_IME) 00972 SetUndetermineAttribute(Console) ; 00973 #endif 00974 Status = CreateEUDC(Console); 00975 if (!NT_SUCCESS(Status)){ 00976 goto ErrorExit1c; 00977 } 00978 #endif 00979 Status = InitializeIoHandleTable(Console, 00980 ProcessData, 00981 StdIn, 00982 StdOut, 00983 StdErr 00984 ); 00985 if (!NT_SUCCESS(Status)) { 00986 goto ErrorExit0; 00987 } 00988 00989 // 00990 // map event handles 00991 // 00992 00993 if (!MapHandle(ClientProcessHandle, 00994 Console->InitEvents[INITIALIZATION_SUCCEEDED], 00995 &ConsoleInfo->InitEvents[INITIALIZATION_SUCCEEDED] 00996 )) { 00997 Status = STATUS_NO_MEMORY; 00998 goto ErrorExit0; 00999 } 01000 if (!MapHandle(ClientProcessHandle, 01001 Console->InitEvents[INITIALIZATION_FAILED], 01002 &ConsoleInfo->InitEvents[INITIALIZATION_FAILED] 01003 )) { 01004 Status = STATUS_NO_MEMORY; 01005 goto ErrorExit0; 01006 } 01007 if (!MapHandle(ClientProcessHandle, 01008 Console->InputBuffer.InputWaitEvent, 01009 &ConsoleInfo->InputWaitHandle 01010 )) { 01011 Status = STATUS_NO_MEMORY; 01012 goto ErrorExit0; 01013 } 01014 01015 Success = PostThreadMessage(dwConsoleThreadId, 01016 CM_CREATE_CONSOLE_WINDOW, 01017 (WPARAM)ConsoleHandle, 01018 (LPARAM)ClientProcessHandle 01019 ); 01020 if (!Success) { 01021 KdPrint(("CONSRV: PostThreadMessage failed %d\n",GetLastError())); 01022 Status = STATUS_UNSUCCESSFUL; 01023 goto ErrorExit0; 01024 } 01025 01026 return STATUS_SUCCESS; 01027 01028 ErrorExit0: Console->ScreenBuffers->RefCount = 0; 01029 #if defined(FE_SB) 01030 if (Console->EudcInformation != NULL) { 01031 ConsoleHeapFree(Console->EudcInformation); 01032 } 01033 ErrorExit1c: 01034 #endif 01035 FreeScreenBuffer(Console->ScreenBuffers); 01036 ErrorExit1b: NtClose(Console->TerminationEvent); 01037 ErrorExit1a: ConsoleHeapFree(Console->OriginalTitle); 01038 ErrorExit1: ConsoleHeapFree(Console->Title); 01039 ErrorExit2: Console->InputBuffer.RefCount = 0; 01040 FreeInputBuffer(&Console->InputBuffer); 01041 ErrorExit3: RtlDeleteCriticalSection(&Console->ConsoleLock); 01042 01043 ErrorExit3a: NtClose(Console->InitEvents[INITIALIZATION_FAILED]); 01044 ErrorExit4: NtClose(Console->InitEvents[INITIALIZATION_SUCCEEDED]); 01045 ErrorExit4a: NtClose(Console->ClientThreadHandle); 01046 ErrorExit5: ConsoleHeapFree(Console); 01047 return Status; 01048 }

NTSTATUS AllocateConsoleHandle OUT PHANDLE  Handle  ) 
 

Definition at line 269 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_HANDLE_ALLOCATED, ConsoleHandles, ConsoleHandleTableLocked, FALSE, GrowConsoleHandleTable(), Handle, HandleFromIndex, NT_SUCCESS, NTSTATUS(), NULL, NumberOfConsoleHandles, and Status.

Referenced by SetUpConsole().

00275 : 00276 00277 This routine allocates a console handle from the global table. 00278 00279 Arguments: 00280 00281 Handle - Pointer to store handle in. 00282 00283 Return Value: 00284 00285 Note: 00286 00287 The console handle table lock must be held when calling this routine. 00288 00289 --*/ 00290 00291 { 00292 ULONG i; 00293 NTSTATUS Status; 00294 00295 ASSERT(ConsoleHandleTableLocked()); 00296 00297 // 00298 // have to start allocation at 1 because 0 indicates no console handle 00299 // in ConDllInitialize. 00300 // 00301 00302 for (i=1;i<NumberOfConsoleHandles;i++) { 00303 if (ConsoleHandles[i] == NULL) { 00304 ConsoleHandles[i] = (PCONSOLE_INFORMATION) CONSOLE_HANDLE_ALLOCATED; 00305 *Handle = HandleFromIndex(i); 00306 return STATUS_SUCCESS; 00307 } 00308 } 00309 00310 // 00311 // grow console handle table 00312 // 00313 00314 Status = GrowConsoleHandleTable(); 00315 if (!NT_SUCCESS(Status)) 00316 return Status; 00317 for ( ;i<NumberOfConsoleHandles;i++) { 00318 if (ConsoleHandles[i] == NULL) { 00319 ConsoleHandles[i] = (PCONSOLE_INFORMATION) CONSOLE_HANDLE_ALLOCATED; 00320 *Handle = HandleFromIndex(i); 00321 return STATUS_SUCCESS; 00322 } 00323 } 00324 ASSERT (FALSE); 00325 return STATUS_UNSUCCESSFUL; 00326 }

NTSTATUS AllocateIoHandle IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN ULONG  HandleType,
OUT PHANDLE  Handle
 

Definition at line 1390 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_FREE_HANDLE, FALSE, GrowIoHandleTable(), Handle, NT_SUCCESS, NTSTATUS(), and Status.

Referenced by InitializeIoHandleTable(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), and SrvOpenConsole().

01398 : 01399 01400 This routine allocates an input or output handle from the process's 01401 handle table. 01402 01403 This routine initializes all non-type specific fields in the handle 01404 data structure. 01405 01406 Arguments: 01407 01408 ProcessData - Pointer to per process data structure. 01409 01410 HandleType - Flag indicating input or output handle. 01411 01412 Handle - On return, contains allocated handle. Handle is an index 01413 internally. When returned to the API caller, it is translated into 01414 a handle. 01415 01416 Return Value: 01417 01418 Note: 01419 01420 The console lock must be held when calling this routine. The handle 01421 is allocated from the per-process handle table. Holding the console 01422 lock serializes both threads within the calling process and any other 01423 process that shares the console. 01424 01425 --*/ 01426 01427 { 01428 ULONG i; 01429 NTSTATUS Status; 01430 01431 for (i=0;i<ProcessData->HandleTableSize;i++) { 01432 if (ProcessData->HandleTablePtr[i].HandleType == CONSOLE_FREE_HANDLE) { 01433 ProcessData->HandleTablePtr[i].HandleType = HandleType; 01434 *Handle = (HANDLE) i; 01435 01436 return STATUS_SUCCESS; 01437 } 01438 } 01439 Status = GrowIoHandleTable(ProcessData); 01440 if (!NT_SUCCESS(Status)) 01441 return Status; 01442 for ( ;i<ProcessData->HandleTableSize;i++) { 01443 if (ProcessData->HandleTablePtr[i].HandleType == CONSOLE_FREE_HANDLE) { 01444 ProcessData->HandleTablePtr[i].HandleType = HandleType; 01445 *Handle = (HANDLE) i; 01446 return STATUS_SUCCESS; 01447 } 01448 } 01449 ASSERT (FALSE); 01450 return STATUS_UNSUCCESSFUL; 01451 }

NTSTATUS ApiPreamble IN HANDLE  ConsoleHandle,
OUT PCONSOLE_INFORMATION Console
 

Definition at line 1627 of file w32/ntcon/server/handle.c.

References CONSOLE_CLIENTPROCESSID, CONSOLE_GETCONSOLEHANDLE, CONSOLE_TERMINATING, _CONSOLE_INFORMATION::ConsoleHandle, ConsoleVDMCriticalSection, ConsoleVDMOnSwitching, NT_SUCCESS, NTSTATUS(), NULL, RevalidateConsole(), Status, UnlockConsole(), and _CONSOLE_INFORMATION::VDMProcessId.

Referenced by SrvAddConsoleAlias(), SrvCloseHandle(), SrvConsoleMenuControl(), SrvConsoleNotifyLastClose(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), SrvExpungeConsoleCommandHistory(), SrvFillConsoleOutput(), SrvFlushConsoleInputBuffer(), SrvGenerateConsoleCtrlEvent(), SrvGetConsoleAlias(), SrvGetConsoleAliases(), SrvGetConsoleAliasesLength(), SrvGetConsoleAliasExes(), SrvGetConsoleAliasExesLength(), SrvGetConsoleCommandHistory(), SrvGetConsoleCommandHistoryLength(), SrvGetConsoleCP(), SrvGetConsoleCurrentFont(), SrvGetConsoleCursorInfo(), SrvGetConsoleDisplayMode(), SrvGetConsoleFontInfo(), SrvGetConsoleFontSize(), SrvGetConsoleHardwareState(), SrvGetConsoleInput(), SrvGetConsoleKeyboardLayoutName(), SrvGetConsoleLangId(), SrvGetConsoleMode(), SrvGetConsoleMouseInfo(), SrvGetConsoleNumberOfFonts(), SrvGetConsoleNumberOfInputEvents(), SrvGetConsoleScreenBufferInfo(), SrvGetConsoleTitle(), SrvGetConsoleWindow(), SrvGetHandleInformation(), SrvGetLargestConsoleWindowSize(), SrvInvalidateBitMapRect(), SrvOpenConsole(), SrvReadConsole(), SrvReadConsoleOutput(), SrvReadConsoleOutputString(), SrvRegisterConsoleVDM(), SrvScrollConsoleScreenBuffer(), SrvSetConsoleActiveScreenBuffer(), SrvSetConsoleCommandHistoryMode(), SrvSetConsoleCP(), SrvSetConsoleCursor(), SrvSetConsoleCursorInfo(), SrvSetConsoleCursorPosition(), SrvSetConsoleDisplayMode(), SrvSetConsoleFont(), SrvSetConsoleHardwareState(), SrvSetConsoleIcon(), SrvSetConsoleKeyShortcuts(), SrvSetConsoleMenuClose(), SrvSetConsoleMode(), SrvSetConsoleNumberOfCommands(), SrvSetConsolePalette(), SrvSetConsoleScreenBufferSize(), SrvSetConsoleTextAttribute(), SrvSetConsoleTitle(), SrvSetConsoleWindowInfo(), SrvSetHandleInformation(), SrvShowConsoleCursor(), SrvVDMConsoleOperation(), SrvVerifyConsoleIoHandle(), SrvWriteConsole(), SrvWriteConsoleInput(), SrvWriteConsoleOutput(), and SrvWriteConsoleOutputString().

01631 { 01632 NTSTATUS Status; 01633 01634 // 01635 // If this process doesn't have a console handle, bail immediately. 01636 // 01637 01638 if (ConsoleHandle == NULL || ConsoleHandle != CONSOLE_GETCONSOLEHANDLE()) { 01639 return STATUS_INVALID_HANDLE; 01640 } 01641 01642 #ifdef i386 01643 //Do not lock the console if we are in the special case: 01644 //(1). we are in the middle of handshaking with ntvdm doing 01645 // full-screen to windowed mode transition 01646 //(2). the calling process is THE ntvdm process(this implies that the 01647 // the console has vdm registered. 01648 //(3). the console handle is the same one. 01649 // if (1), (2) and (3) are true then the console is already locked 01650 // (locked by the windowproc while processing the WM_FULLSCREEN 01651 // message) 01652 01653 RtlEnterCriticalSection(&ConsoleVDMCriticalSection); 01654 if (ConsoleVDMOnSwitching != NULL && 01655 ConsoleVDMOnSwitching->ConsoleHandle == ConsoleHandle && 01656 ConsoleVDMOnSwitching->VDMProcessId == CONSOLE_CLIENTPROCESSID()) 01657 { 01658 KdPrint((" ApiPreamble - Thread %lx Entered VDM CritSec\n", GetCurrentThreadId())); 01659 *Console = ConsoleVDMOnSwitching; 01660 return STATUS_SUCCESS; 01661 } 01662 RtlLeaveCriticalSection(&ConsoleVDMCriticalSection); 01663 #endif 01664 01665 Status = RevalidateConsole(ConsoleHandle, 01666 Console 01667 ); 01668 if (!NT_SUCCESS(Status)) { 01669 return((ULONG) Status); 01670 } 01671 01672 // 01673 // Make sure the console has been initialized and the window is valid 01674 // 01675 01676 if ((*Console)->hWnd == NULL || ((*Console)->Flags & CONSOLE_TERMINATING)) { 01677 KdPrint(("CONSRV: bogus window for console %lx\n", *Console)); 01678 UnlockConsole(*Console); 01679 return STATUS_INVALID_HANDLE; 01680 } 01681 01682 return Status; 01683 }

NTSTATUS ChangeDispSettings PCONSOLE_INFORMATION  Console,
HWND  hwnd,
DWORD  dwFlags
 

Referenced by ConsoleWindowProc(), CreateWindowsWindow(), HandleSysKeyEvent(), and PropertiesUpdate().

WCHAR CharToWchar IN UINT  Codepage,
IN char  Ch
 

Definition at line 1469 of file w32/ntcon/server/misc.c.

References DBGCHARS, NULL, OEMCP, and RtlOemToUnicodeN().

Referenced by GetChar(), SB_TranslateOutputToUnicode(), SrvScrollConsoleScreenBuffer(), and TranslateInputToUnicode().

01473 { 01474 WCHAR wch; 01475 if (Codepage == OEMCP) { 01476 RtlOemToUnicodeN(&wch, sizeof(wch), NULL, &Ch, sizeof(Ch)); 01477 } else { 01478 MultiByteToWideChar(Codepage, 0, &Ch, 1, &wch, 1); 01479 } 01480 #ifdef DEBUG_PRINT 01481 if (Ch > 0x7F) { 01482 DBGCHARS(("CharToWchar %d 0x%02x -> 0x%04x\n",Codepage,(UCHAR)Ch,wch)); 01483 } 01484 #endif 01485 return wch; 01486 }

WCHAR CharToWcharGlyph IN UINT  Codepage,
IN char  Ch
 

Definition at line 1443 of file w32/ntcon/server/misc.c.

References DBGCHARS, GlyphCP, NULL, OEMCP, and RtlCustomCPToUnicodeN().

01447 { 01448 WCHAR wch; 01449 if (Codepage == OEMCP) { 01450 RtlCustomCPToUnicodeN(&GlyphCP, &wch, sizeof(wch), NULL, &Ch, sizeof(Ch)); 01451 } else { 01452 MultiByteToWideChar(Codepage, MB_USEGLYPHCHARS, &Ch, 1, &wch, 1); 01453 } 01454 #ifdef DEBUG_PRINT 01455 if (Ch > 0x7F) { 01456 DBGCHARS(("CharToWcharGlyph %d 0x%02x -> 0x%04x\n",Codepage,(UCHAR)Ch,wch)); 01457 } 01458 #endif 01459 return wch; 01460 }

VOID ClearKeyInfo IN HWND  hWnd  ) 
 

Definition at line 1634 of file ntcon/server/input.c.

References CONSOLE_FREE_KEY_INFO, CONSOLE_MAX_KEY_INFO, ConsoleKeyInfo, _CONSOLE_KEY_INFO::hWnd, and hWnd.

Referenced by DestroyWindowsWindow().

01637 { 01638 int i; 01639 01640 for (i=0;i<CONSOLE_MAX_KEY_INFO;i++) { 01641 if (ConsoleKeyInfo[i].hWnd == hWnd) { 01642 ConsoleKeyInfo[i].hWnd = CONSOLE_FREE_KEY_INFO; 01643 } 01644 } 01645 }

VOID ClearScroll IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1222 of file ntcon/server/clipbrd.c.

References CONSOLE_SCROLLING, FALSE, msgScrollMode, and SetWinText().

Referenced by HandleKeyEvent().

01225 { 01226 SetWinText(Console,msgScrollMode,FALSE); 01227 Console->Flags &= ~CONSOLE_SCROLLING; 01228 }

VOID ClearSelection IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 437 of file ntcon/server/clipbrd.c.

References CancelKeySelection(), CancelMouseSelection(), CONSOLE_MOUSE_SELECTION, CONSOLE_SELECTING, FALSE, and UnblockWriteConsole().

Referenced by DoCopy(), DoSelectAll(), FindDialogProc(), and HandleKeyEvent().

00440 { 00441 if (Console->Flags & CONSOLE_SELECTING) { 00442 if (Console->SelectionFlags & CONSOLE_MOUSE_SELECTION) { 00443 CancelMouseSelection(Console); 00444 } else { 00445 CancelKeySelection(Console,FALSE); 00446 } 00447 UnblockWriteConsole(Console, CONSOLE_SELECTING); 00448 } 00449 }

NTSTATUS CloseInputHandle IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN PCONSOLE_INFORMATION  Console,
IN PHANDLE_DATA  HandleData,
IN HANDLE  Handle
 

Definition at line 2844 of file server/stream.c.

References ASSERT, ConsoleHeapFree, ConsoleRemoveShare(), FALSE, FreeIoHandle(), Handle, HANDLE_CLOSING, HANDLE_INPUT_PENDING, LockReadCount, NULL, ReinitializeInputBuffer(), TRUE, and UnlockReadCount.

Referenced by RemoveConsole(), SrvCloseHandle(), and SrvDuplicateHandle().

02853 : 02854 02855 This routine closes an input handle. It decrements the input buffer's 02856 reference count. If it goes to zero, the buffer is reinitialized. 02857 Otherwise, the handle is removed from sharing. 02858 02859 Arguments: 02860 02861 ProcessData - Pointer to per process data. 02862 02863 HandleData - Pointer to handle data structure. 02864 02865 Handle - Handle to close. 02866 02867 Return Value: 02868 02869 Note: 02870 02871 The console lock must be held when calling this routine. 02872 02873 --*/ 02874 02875 { 02876 BOOLEAN WaitSatisfied = FALSE; 02877 02878 ASSERT(ProcessData->Foo == 0xF00); 02879 if (HandleData->InputReadData->InputHandleFlags & HANDLE_INPUT_PENDING) { 02880 HandleData->InputReadData->InputHandleFlags &= ~HANDLE_INPUT_PENDING; 02881 ConsoleHeapFree(HandleData->InputReadData->BufPtr); 02882 } 02883 02884 // 02885 // see if there are any reads waiting for data via this handle. if 02886 // there are, wake them up. there aren't any other outstanding i/o 02887 // operations via this handle because the console lock is held. 02888 // 02889 02890 LockReadCount(HandleData); 02891 if (HandleData->InputReadData->ReadCount != 0) { 02892 UnlockReadCount(HandleData); 02893 HandleData->InputReadData->InputHandleFlags |= HANDLE_CLOSING; 02894 02895 WaitSatisfied |= CsrNotifyWait(&HandleData->Buffer.InputBuffer->ReadWaitQueue, 02896 TRUE, 02897 (PVOID) HandleData, 02898 NULL 02899 ); 02900 LockReadCount(HandleData); 02901 } 02902 if (WaitSatisfied) { 02903 // #334370 under stress, WaitQueue may already hold the satisfied waits 02904 ASSERT ((Console->WaitQueue == NULL) || 02905 (Console->WaitQueue == &HandleData->Buffer.InputBuffer->ReadWaitQueue)); 02906 Console->WaitQueue = &HandleData->Buffer.InputBuffer->ReadWaitQueue; 02907 } 02908 if (HandleData->InputReadData->ReadCount != 0) { 02909 KdPrint(("ReadCount is %lX\n",HandleData->InputReadData->ReadCount)); 02910 } 02911 ASSERT (HandleData->InputReadData->ReadCount == 0); 02912 UnlockReadCount(HandleData); 02913 02914 ASSERT (HandleData->Buffer.InputBuffer->RefCount); 02915 HandleData->Buffer.InputBuffer->RefCount--; 02916 if (HandleData->Buffer.InputBuffer->RefCount == 0) { 02917 ReinitializeInputBuffer(HandleData->Buffer.InputBuffer); 02918 } 02919 else { 02920 ConsoleRemoveShare(HandleData->Access, 02921 HandleData->ShareAccess, 02922 &HandleData->Buffer.InputBuffer->ShareAccess 02923 ); 02924 } 02925 return FreeIoHandle(ProcessData,Handle); 02926 }

NTSTATUS CloseOutputHandle IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN PCONSOLE_INFORMATION  Console,
IN PHANDLE_DATA  HandleData,
IN HANDLE  Handle,
IN BOOLEAN  FreeHandle
 

Definition at line 2929 of file server/stream.c.

References ASSERT, ConsoleRemoveShare(), FreeIoHandle(), FreeScreenBuffer(), Handle, NTSTATUS(), NULL, RemoveScreenBuffer(), SetActiveScreenBuffer(), and Status.

Referenced by CookedRead(), CookedReadWaitRoutine(), ProcessCommandListInput(), ReadChars(), RemoveConsole(), SrvCloseHandle(), and SrvDuplicateHandle().

02939 : 02940 02941 This routine closes an output handle. It decrements the screen buffer's 02942 reference count. If it goes to zero, the buffer is freed. Otherwise, 02943 the handle is removed from sharing. 02944 02945 Arguments: 02946 02947 ProcessData - Pointer to per process data. 02948 02949 Console - Pointer to console information structure. 02950 02951 HandleData - Pointer to handle data structure. 02952 02953 Handle - Handle to close. 02954 02955 FreeHandle - if TRUE, free handle. used by ReadChars in echo mode 02956 and by process cleanup. 02957 02958 Return Value: 02959 02960 Note: 02961 02962 The console lock must be held when calling this routine. 02963 02964 --*/ 02965 02966 { 02967 NTSTATUS Status; 02968 02969 ASSERT(ProcessData->Foo == 0xF00); 02970 ASSERT (HandleData->Buffer.ScreenBuffer->RefCount); 02971 HandleData->Buffer.ScreenBuffer->RefCount--; 02972 if (HandleData->Buffer.ScreenBuffer->RefCount == 0) { 02973 RemoveScreenBuffer(Console,HandleData->Buffer.ScreenBuffer); 02974 if (HandleData->Buffer.ScreenBuffer == Console->CurrentScreenBuffer && 02975 Console->ScreenBuffers != Console->CurrentScreenBuffer) { 02976 if (Console->ScreenBuffers != NULL) { 02977 SetActiveScreenBuffer(Console->ScreenBuffers); 02978 } else { 02979 Console->CurrentScreenBuffer = NULL; 02980 } 02981 } 02982 Status = FreeScreenBuffer(HandleData->Buffer.ScreenBuffer); 02983 } 02984 else { 02985 Status = ConsoleRemoveShare(HandleData->Access, 02986 HandleData->ShareAccess, 02987 &HandleData->Buffer.ScreenBuffer->ShareAccess 02988 ); 02989 } 02990 if (FreeHandle) 02991 Status = FreeIoHandle(ProcessData,Handle); 02992 return Status; 02993 }

NTSTATUS ConsoleAddProcessRoutine IN PCSR_PROCESS  ParentProcess,
IN PCSR_PROCESS  Process
 

Definition at line 705 of file w32/ntcon/server/handle.c.

References AddProcessToList(), ASSERT, CONSOLE_FREE_HANDLE, CONSOLE_FROMPROCESSPERPROCESSDATA, CONSOLE_INITIAL_IO_HANDLES, CONSOLE_SETCONSOLEAPPFROMPROCESSDATA, CONSOLE_SHUTTING_DOWN, _CONSOLE_PER_PROCESS_DATA::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, _CONSOLE_PROCESS_HANDLE::CtrlRoutine, FALSE, _CONSOLE_INFORMATION::Flags, _CONSOLE_PER_PROCESS_DATA::Foo, HANDLE_TAG, _CONSOLE_PER_PROCESS_DATA::HandleTable, _CONSOLE_PER_PROCESS_DATA::HandleTablePtr, _CONSOLE_PER_PROCESS_DATA::HandleTableSize, _HANDLE_DATA::HandleType, InheritIoHandleTable(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_PROCESS_HANDLE::Process, _CONSOLE_PROCESS_HANDLE::ProcessHandle, _CONSOLE_PROCESS_HANDLE::PropRoutine, _CONSOLE_INFORMATION::RefCount, RevalidateConsole(), _CONSOLE_PER_PROCESS_DATA::RootProcess, Status, and UnlockConsole().

Referenced by ConServerDllInitialization().

00709 { 00710 PCONSOLE_PER_PROCESS_DATA ProcessData, ParentProcessData; 00711 PCONSOLE_INFORMATION Console; 00712 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00713 NTSTATUS Status = STATUS_SUCCESS; 00714 ULONG i; 00715 00716 ProcessData = CONSOLE_FROMPROCESSPERPROCESSDATA(Process); 00717 ProcessData->HandleTablePtr = ProcessData->HandleTable; 00718 ProcessData->HandleTableSize = CONSOLE_INITIAL_IO_HANDLES; 00719 CONSOLE_SETCONSOLEAPPFROMPROCESSDATA(ProcessData,FALSE); 00720 00721 if (ParentProcess) { 00722 00723 ProcessData->RootProcess = FALSE; 00724 ParentProcessData = CONSOLE_FROMPROCESSPERPROCESSDATA(ParentProcess); 00725 00726 // 00727 // If both the parent and new processes are console apps, 00728 // inherit handles from the parent process. 00729 // 00730 00731 if (ParentProcessData->ConsoleHandle != NULL && 00732 (Process->Flags & CSR_PROCESS_CONSOLEAPP)) { 00733 if (!(NT_SUCCESS(RevalidateConsole(ParentProcessData->ConsoleHandle, 00734 &Console)))) { 00735 ProcessData->ConsoleHandle = NULL; 00736 return STATUS_PROCESS_IS_TERMINATING; 00737 } 00738 00739 // 00740 // Don't add the process if the console is being shutdown. 00741 // 00742 00743 if (Console->Flags & CONSOLE_SHUTTING_DOWN) { 00744 Status = STATUS_PROCESS_IS_TERMINATING; 00745 } else { 00746 ProcessHandleRecord = ConsoleHeapAlloc(MAKE_TAG( HANDLE_TAG ),sizeof(CONSOLE_PROCESS_HANDLE)); 00747 if (ProcessHandleRecord == NULL) { 00748 Status = STATUS_NO_MEMORY; 00749 } else { 00750 00751 // 00752 // duplicate parent's handle table 00753 // 00754 00755 ASSERT(ProcessData->Foo == 0xF00); 00756 Status = InheritIoHandleTable(Console, ProcessData, ParentProcessData); 00757 if (NT_SUCCESS(Status)) { 00758 ProcessHandleRecord->Process = Process; 00759 ProcessHandleRecord->CtrlRoutine = NULL; 00760 ProcessHandleRecord->PropRoutine = NULL; 00761 AddProcessToList(Console,ProcessHandleRecord,Process->ProcessHandle); 00762 00763 // 00764 // increment console reference count 00765 // 00766 00767 Console->RefCount++; 00768 } else { 00769 ConsoleHeapFree(ProcessHandleRecord); 00770 } 00771 } 00772 } 00773 if (!NT_SUCCESS(Status)) { 00774 ProcessData->ConsoleHandle = NULL; 00775 for (i=0;i<CONSOLE_INITIAL_IO_HANDLES;i++) { 00776 ProcessData->HandleTable[i].HandleType = CONSOLE_FREE_HANDLE; 00777 } 00778 } 00779 UnlockConsole(Console); 00780 } else 00781 ProcessData->ConsoleHandle = NULL; 00782 } else { 00783 ProcessData->ConsoleHandle = NULL; 00784 } 00785 return Status; 00786 }

NTSTATUS ConsoleAddShare IN ACCESS_MASK  DesiredAccess,
IN ULONG  DesiredShareAccess,
IN OUT PCONSOLE_SHARE_ACCESS  ShareAccess,
IN OUT PHANDLE_DATA  HandleData
 

Definition at line 25 of file share.c.

Referenced by InitializeIoHandleTable(), ReadChars(), SrvCreateConsoleScreenBuffer(), and SrvOpenConsole().

00032 { 00033 ULONG Ocount; 00034 ULONG ReadAccess; 00035 ULONG WriteAccess; 00036 ULONG SharedRead; 00037 ULONG SharedWrite; 00038 00039 // 00040 // Set the access type in the file object for the current accessor. 00041 // 00042 00043 ReadAccess = (DesiredAccess & GENERIC_READ) != 0; 00044 WriteAccess = (DesiredAccess & GENERIC_WRITE) != 0; 00045 00046 SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; 00047 SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; 00048 00049 // 00050 // Now check to see whether or not the desired accesses are compatible 00051 // with the way that the file is currently open. 00052 // 00053 00054 Ocount = ShareAccess->OpenCount; 00055 00056 if ( (ReadAccess && (ShareAccess->SharedRead < Ocount)) 00057 || 00058 (WriteAccess && (ShareAccess->SharedWrite < Ocount)) 00059 || 00060 ((ShareAccess->Readers != 0) && !SharedRead) 00061 || 00062 ((ShareAccess->Writers != 0) && !SharedWrite) 00063 ) { 00064 00065 // 00066 // The check failed. Simply return to the caller indicating that the 00067 // current open cannot access the file. 00068 // 00069 00070 return STATUS_SHARING_VIOLATION; 00071 00072 } else { 00073 00074 // 00075 // The check was successful. Update the counter information in the 00076 // shared access structure for this open request if the caller 00077 // specified that it should be updated. 00078 // 00079 00080 ShareAccess->OpenCount++; 00081 00082 ShareAccess->Readers += ReadAccess; 00083 ShareAccess->Writers += WriteAccess; 00084 00085 ShareAccess->SharedRead += SharedRead; 00086 ShareAccess->SharedWrite += SharedWrite; 00087 HandleData->Access = DesiredAccess; 00088 HandleData->ShareAccess = DesiredShareAccess; 00089 00090 return STATUS_SUCCESS; 00091 } 00092 }

UINT ConsoleDragQueryFile IN HANDLE  hDrop,
IN PVOID  lpFile,
IN UINT  cb
 

Definition at line 5750 of file output.c.

References BOOL, EXCEPTION_EXECUTE_HANDLER, and UINT.

Referenced by DoDrop().

05755 { 05756 UINT i = 0; 05757 LPDROPFILESTRUCT lpdfs; 05758 BOOL fWide; 05759 05760 lpdfs = (LPDROPFILESTRUCT)GlobalLock(hDrop); 05761 05762 if (lpdfs && lpdfs != hDrop) 05763 { 05764 try { 05765 fWide = (LOWORD(lpdfs->pFiles) == sizeof(DROPFILES)); 05766 if (fWide) 05767 { 05768 // 05769 // This is a new (NT-compatible) HDROP 05770 // 05771 fWide = lpdfs->fWide; // Redetermine fWide from struct 05772 // since it is present. 05773 } 05774 05775 if (fWide) 05776 { 05777 LPWSTR lpList; 05778 05779 // 05780 // UNICODE HDROP 05781 // 05782 05783 lpList = (LPWSTR)((LPBYTE)lpdfs + lpdfs->pFiles); 05784 05785 i = lstrlenW(lpList); 05786 05787 if (!i) 05788 goto Exit; 05789 05790 cb--; 05791 if (cb < i) 05792 i = cb; 05793 05794 lstrcpynW((LPWSTR)lpFile, lpList, i + 1); 05795 } 05796 else 05797 { 05798 LPSTR lpList; 05799 05800 // 05801 // This is Win31-style HDROP or an ANSI NT Style HDROP 05802 // 05803 lpList = (LPSTR)((LPBYTE)lpdfs + lpdfs->pFiles); 05804 05805 i = lstrlenA(lpList); 05806 05807 if (!i) 05808 goto Exit; 05809 05810 cb--; 05811 if (cb < i) 05812 i = cb; 05813 05814 MultiByteToWideChar(CP_ACP, 0, lpList, -1, (LPWSTR)lpFile, cb); 05815 05816 } 05817 } except( EXCEPTION_EXECUTE_HANDLER ) { 05818 KdPrint(("CONSRV: WM_DROPFILES raised exception\n")); 05819 i = 0; 05820 } 05821 Exit: 05822 GlobalUnlock(hDrop); 05823 GlobalFree(hDrop); 05824 } 05825 05826 return(i); 05827 }

NTSTATUS ConsoleDupShare IN ACCESS_MASK  DesiredAccess,
IN ULONG  DesiredShareAccess,
IN OUT PCONSOLE_SHARE_ACCESS  ShareAccess,
IN OUT PHANDLE_DATA  TargetHandleData
 

Definition at line 95 of file share.c.

References ASSERT, and FALSE.

Referenced by InheritIoHandleTable(), and SrvDuplicateHandle().

00102 { 00103 ULONG ReadAccess; 00104 ULONG WriteAccess; 00105 ULONG SharedRead; 00106 ULONG SharedWrite; 00107 00108 // 00109 // Set the access type in the file object for the current accessor. 00110 // 00111 00112 ReadAccess = (DesiredAccess & GENERIC_READ) != 0; 00113 WriteAccess = (DesiredAccess & GENERIC_WRITE) != 0; 00114 00115 SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; 00116 SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; 00117 00118 if (ShareAccess->OpenCount == 0) { 00119 ASSERT (FALSE); 00120 return STATUS_SHARING_VIOLATION; 00121 } 00122 00123 ShareAccess->OpenCount++; 00124 00125 ShareAccess->Readers += ReadAccess; 00126 ShareAccess->Writers += WriteAccess; 00127 00128 ShareAccess->SharedRead += SharedRead; 00129 ShareAccess->SharedWrite += SharedWrite; 00130 00131 TargetHandleData->Access = DesiredAccess; 00132 TargetHandleData->ShareAccess = DesiredShareAccess; 00133 00134 return STATUS_SUCCESS; 00135 }

VOID ConsoleHideCursor IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 207 of file ntcon/server/cursor.c.

References CONSOLE_IS_ICONIC, CONSOLE_TEXTMODE_BUFFER, FALSE, and InvertPixels().

Referenced by CancelKeySelection(), ConsoleWindowProc(), EndPopup(), ExtendSelection(), HandleKeyEvent(), InitSelection(), ScrollRegion(), SetCursorInformation(), SetCursorMode(), SetCursorPosition(), SetWindowOrigin(), StreamScrollRegion(), WWSB_DoWriteConsole(), WWSB_WriteChars(), and WWSB_WriteToScreen().

00213 : 00214 00215 This routine makes the cursor invisible both in the data structures 00216 and on the screen. 00217 00218 Arguments: 00219 00220 ScreenInfo - pointer to screen info structure. 00221 00222 Return Value: 00223 00224 none. 00225 00226 --*/ 00227 00228 { 00229 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00230 if (++ScreenInfo->BufferInfo.TextInfo.UpdatingScreen == 1) { 00231 if (ScreenInfo->BufferInfo.TextInfo.CursorVisible && 00232 ScreenInfo->BufferInfo.TextInfo.CursorOn && 00233 ScreenInfo->Console->CurrentScreenBuffer == ScreenInfo && 00234 !(ScreenInfo->Console->Flags & CONSOLE_IS_ICONIC)) { 00235 InvertPixels(ScreenInfo); 00236 ScreenInfo->BufferInfo.TextInfo.CursorOn = FALSE; 00237 } 00238 } 00239 } 00240 }

VOID ConsoleInputThread IN PINPUT_THREAD_INIT_INFO  pInputThreadInitInfo  ) 
 

Referenced by InitWindowsStuff().

NTSTATUS ConsoleRemoveShare IN ULONG  DesiredAccess,
IN ULONG  DesiredShareAccess,
IN OUT PCONSOLE_SHARE_ACCESS  ShareAccess
 

Definition at line 138 of file share.c.

References ASSERT, and FALSE.

Referenced by CloseInputHandle(), and CloseOutputHandle().

00144 { 00145 ULONG ReadAccess; 00146 ULONG WriteAccess; 00147 ULONG SharedRead; 00148 ULONG SharedWrite; 00149 00150 // 00151 // Set the access type in the file object for the current accessor. 00152 // 00153 00154 ReadAccess = (DesiredAccess & GENERIC_READ) != 0; 00155 WriteAccess = (DesiredAccess & GENERIC_WRITE) != 0; 00156 00157 SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; 00158 SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; 00159 00160 if (ShareAccess->OpenCount == 0) { 00161 ASSERT (FALSE); 00162 return STATUS_UNSUCCESSFUL; 00163 } 00164 00165 ShareAccess->OpenCount--; 00166 00167 ShareAccess->Readers -= ReadAccess; 00168 ShareAccess->Writers -= WriteAccess; 00169 00170 ShareAccess->SharedRead -= SharedRead; 00171 ShareAccess->SharedWrite -= SharedWrite; 00172 00173 return STATUS_SUCCESS; 00174 }

VOID ConsoleShowCursor IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 176 of file ntcon/server/cursor.c.

References ASSERT, CONSOLE_TEXTMODE_BUFFER, and FALSE.

Referenced by CancelKeySelection(), ConsoleWindowProc(), EndPopup(), HandleKeyEvent(), InitSelection(), ScrollRegion(), SetCursorInformation(), SetCursorMode(), SetCursorPosition(), SetWindowOrigin(), StreamScrollRegion(), WWSB_DoWriteConsole(), WWSB_WriteChars(), and WWSB_WriteToScreen().

00182 : 00183 00184 This routine makes the cursor visible both in the data structures 00185 and on the screen. 00186 00187 Arguments: 00188 00189 ScreenInfo - pointer to screen info structure. 00190 00191 Return Value: 00192 00193 none. 00194 00195 --*/ 00196 00197 { 00198 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00199 ASSERT (ScreenInfo->BufferInfo.TextInfo.UpdatingScreen>0); 00200 if (--ScreenInfo->BufferInfo.TextInfo.UpdatingScreen == 0) { 00201 ScreenInfo->BufferInfo.TextInfo.CursorOn = FALSE; 00202 } 00203 } 00204 }

LRESULT APIENTRY ConsoleWindowProc HWND  hWnd,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 4700 of file output.c.

References abs, ActivateKeyboardLayout, ASSERT, _SCREEN_INFORMATION::Attributes, BeginPaint, _CONSOLE_INFORMATION::bIconInit, BOOL, _SCREEN_INFORMATION::BufferInfo, ChangeDispSettings(), CHAR, _CONSOLE_INFORMATION::ClientThreadHandle, CM_BEEP, CM_CONIME_KL_ACTIVATE, CM_CONSOLE_MSG, CM_HIDE_WINDOW, CM_MODE_TRANSITION, CM_SET_WINDOW_SIZE, CM_UPDATE_SCROLL_BARS, CM_UPDATE_TITLE, cmControl, cmCopy, cmDefaults, cmFind, cmMark, cmPaste, cmScroll, cmSelectAll, _SCREEN_INFORMATION::CommandIdHigh, _SCREEN_INFORMATION::CommandIdLow, CONIME_INPUTLANGCHANGE, CONIME_INPUTLANGCHANGEREQUEST, CONIME_INPUTLANGCHANGEREQUESTBACKWARD, CONIME_INPUTLANGCHANGEREQUESTFORWARD, CONIME_KEYDATA, CONIME_KILLFOCUS, CONIME_SETFOCUS, _SCREEN_INFORMATION::Console, CONSOLE_GRAPHICS_BUFFER, CONSOLE_HAS_FOCUS, CONSOLE_IGNORE_NEXT_MOUSE_INPUT, CONSOLE_IS_ICONIC, CONSOLE_IS_IME_ENABLED, CONSOLE_NO_WINDOW, CONSOLE_TERMINATING, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, CONSOLE_WOW_REGISTERED, _CONSOLE_INFORMATION::ConsoleHandle, ConsoleHideCursor(), ConsoleShowCursor(), ConvertToFullScreen(), ConvertToWindowed(), CreateIconFromResourceEx(), _CONSOLE_INFORMATION::CurrentScreenBuffer, CURSOR_TIMER, _SCREEN_INFORMATION::CursorDisplayCount, _SCREEN_INFORMATION::CursorHandle, CursorTimerRoutine(), DbgPrint, DefWindowProc(), DestroyIcon, DestroyWindowsWindow(), DisplayModeTransition(), DoCopy(), DoDrop(), DoFind(), DoMark(), DoPaste(), DoScroll(), DoSelectAll(), DrawIcon(), DWORD, FALSE, _CONSOLE_INFORMATION::Flags, _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, _WINDOW_LIMITS::FullScreenSize, GET_X_LPARAM, GET_Y_LPARAM, GetCapture(), GetClientRect(), GetCursorPos(), GetKeyState(), GetLastActivePopup(), GetNonBiDiKeyboardLayout(), GetSystemMetrics(), GetWindowConsole, GetWindowLimits(), gfInitSystemMetrics, ghDefaultIcon, ghDefaultSmIcon, guCaretBlinkTime, gucWheelScrollLines, HandleCtrlEvent(), HandleFocusEvent(), HandleKeyEvent(), HandleMenuEvent(), HandleMouseEvent(), HandleSysKeyEvent(), _CONSOLE_INFORMATION::hDC, _CONSOLE_INFORMATION::hHeirMenu, _CONSOLE_INFORMATION::hIcon, _CONSOLE_INFORMATION::hklActive, HorizontalClientToWindow, HorizontalScroll(), HorizontalScrollSize, _SCREEN_INFORMATION::hPalette, _CONSOLE_INFORMATION::hSmIcon, _CONSOLE_INFORMATION::hSysPalette, hWnd, _CONSOLE_INFORMATION::hWndProgMan, _CONSOLE_INFORMATION::hWndProperties, _CONSOLE_INFORMATION::iIconId, ImmConversionFromConsole(), InitializeMenu(), InitializeSystemMetrics(), _CONSOLE_INFORMATION::InputBuffer, _CONSOLE_INFORMATION::InputThreadInfo, InternalSetWindowSize(), InternalUpdateScrollBars(), _PMIconData::iResource, IS_IME_KBDLAYOUT, IsIconic(), ITEM_MAX_SIZE, KEY_PRESSED, LockConsole, LPPMICONDATA, _WINDOW_LIMITS::MaxWindow, min, _WINDOW_LIMITS::MinimumWindowSize, ModifyConsoleProcessFocus(), NT_SUCCESS, NtClose(), NtSetEvent(), NULL, PaintRect(), PeekMessage(), Point, _SCREEN_INFORMATION::PopupAttributes, PositionConsoleWindow(), PostMessage(), ProcessResizeWindow(), ProgmanHandleMessage, PropertiesDlgShow(), PropertiesUpdate(), QueueConsoleMessage(), ReleaseCapture(), _CONSOLE_INFORMATION::ReserveKeys, _CONSOLE_INFORMATION::ResizeFlags, _SCREEN_INFORMATION::ResizingWindow, ReuseDDElParam, RevalidateConsole(), SCR_FONTSIZE(), SCREEN_BUFFER_CHANGE, SCROLL_BAR_CHANGE, ScrollIfNecessary(), SelectPalette, SendMessage(), SetActivePalette(), SetCapture, SetConsoleReserveKeys(), SetCursor, SetForegroundWindow(), SetScreenColors(), SetTimer, SetWindowOrigin(), SetWindowText(), SHORT, ShowWindow, Status, SystemParametersInfo(), TEXT_VALID_HINT, _CONSOLE_INFORMATION::Title, TrimConsoleWorkingSet(), TRUE, UINT, UnlockConsole(), UnpackDDElParam(), UnqueueConsoleMessage(), UnsetActivePalette(), UpdateWindowSize(), ValidateConsole(), VerticalClientToWindow, VerticalScroll(), VerticalScrollSize, _SCREEN_INFORMATION::WheelDelta, _SCREEN_INFORMATION::Window, WindowFromPoint, _SCREEN_INFORMATION::WindowMaximized, _SCREEN_INFORMATION::WindowMaximizedX, _SCREEN_INFORMATION::WindowMaximizedY, _CONSOLE_INFORMATION::WindowRect, WriteRegionToScreenBitMap(), and WriteToScreen.

Referenced by InitWindowClass().

04706 { 04707 HDC hDC; 04708 PAINTSTRUCT ps; 04709 PCONSOLE_INFORMATION Console; 04710 PSCREEN_INFORMATION ScreenInfo; 04711 SMALL_RECT PaintRect; 04712 LRESULT Status; 04713 04714 Console = GetWindowConsole(hWnd); 04715 if (Console != NULL) { 04716 04717 // 04718 // Set up our thread so we can impersonate the client 04719 // while processing the message. 04720 // 04721 04722 CSR_SERVER_QUERYCLIENTTHREAD()->ThreadHandle = 04723 Console->ClientThreadHandle; 04724 04725 // 04726 // If the console is terminating, don't bother processing messages 04727 // other than CM_DESTROY_WINDOW. 04728 // 04729 if (Console->Flags & CONSOLE_TERMINATING) { 04730 LockConsole(Console); 04731 DestroyWindowsWindow(Console); 04732 return 0; 04733 } 04734 04735 // 04736 // Make sure the console pointer is still valid 04737 // 04738 ASSERT(NT_SUCCESS(ValidateConsole(Console))); 04739 04740 LockConsole(Console); 04741 04742 ScreenInfo = Console->CurrentScreenBuffer; 04743 } 04744 try { 04745 if (Console == NULL || ScreenInfo == NULL) { 04746 switch (Message) { 04747 case WM_GETMINMAXINFO: 04748 { 04749 // 04750 // createwindow issues a WM_GETMINMAXINFO 04751 // message before we have the windowlong set up 04752 // with the console pointer. we need to allow 04753 // the created window to be bigger than the 04754 // default size by the scroll size. 04755 // 04756 04757 LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; 04758 lpmmi->ptMaxTrackSize.y += HorizontalScrollSize; 04759 lpmmi->ptMaxTrackSize.x += VerticalScrollSize; 04760 } 04761 break; 04762 04763 default: 04764 goto CallDefWin; 04765 } 04766 } else if (Message == ProgmanHandleMessage && lParam==0) { 04767 // NOTE: lParam will be 0 if progman is sending it and 04768 // 1 if console is sending it. 04769 Status = 0; 04770 // this is a workaround for a progman bug. progman 04771 // sends a progmanhandlemessage twice for each window 04772 // in the system each time one is requested (for one window). 04773 if ((HWND)wParam != hWnd && Console->bIconInit) { 04774 ATOM App,Topic; 04775 CHAR szItem[ITEM_MAX_SIZE+1]; 04776 PCHAR lpItem; 04777 ATOM aItem; 04778 HANDLE ConsoleHandle; 04779 04780 if (!(Console->Flags & CONSOLE_TERMINATING)) { 04781 ConsoleHandle = Console->ConsoleHandle; 04782 Console->hWndProgMan = (HWND)wParam; 04783 UnlockConsole(Console); 04784 App = GlobalAddAtomA("Shell"); 04785 Topic = GlobalAddAtomA("AppIcon"); 04786 SendMessage(Console->hWndProgMan, 04787 WM_DDE_INITIATE, 04788 (WPARAM)hWnd, 04789 MAKELONG(App,Topic) 04790 ); 04791 04792 // if console is still valid, continue getting icon. 04793 Status = RevalidateConsole(ConsoleHandle, &Console); 04794 if (NT_SUCCESS(Status)) { 04795 Console->bIconInit = FALSE; 04796 lpItem = _itoa((int)Console->iIconId,szItem,10); 04797 aItem = GlobalAddAtomA(lpItem); 04798 PostMessage(Console->hWndProgMan, 04799 WM_DDE_REQUEST, 04800 (WPARAM)hWnd, 04801 MAKELONG(CF_TEXT,aItem) 04802 ); 04803 } 04804 } 04805 } 04806 } else { 04807 Status = 0; 04808 switch (Message) { 04809 case WM_DROPFILES: 04810 DoDrop (wParam,Console); 04811 break; 04812 case WM_MOVE: 04813 if (!IsIconic(hWnd)) { 04814 PositionConsoleWindow(Console, (Console->WindowRect.left == CW_USEDEFAULT)); 04815 #if defined(FE_IME) 04816 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 04817 { 04818 ConsoleImeResizeModeSystemView(Console,ScreenInfo->Window); 04819 ConsoleImeResizeCompStrView(Console,ScreenInfo->Window); 04820 } 04821 #endif // FE_IME 04822 } 04823 break; 04824 case WM_SIZE: 04825 04826 if (wParam != SIZE_MINIMIZED) { 04827 04828 // 04829 // both SetWindowPos and SetScrollRange cause WM_SIZE 04830 // messages to be issued. ignore them if we have already 04831 // figured out what size the window should be. 04832 // 04833 04834 if (!ScreenInfo->ResizingWindow) { 04835 #ifdef THERESES_DEBUG 04836 DbgPrint("WM_SIZE message "); 04837 if (wParam == SIZEFULLSCREEN) 04838 DbgPrint("SIZEFULLSCREEN\n"); 04839 else if (wParam == SIZENORMAL) 04840 DbgPrint("SIZENORMAL\n"); 04841 DbgPrint(" WindowSize is %d %d\n",CONSOLE_WINDOW_SIZE_X(ScreenInfo),CONSOLE_WINDOW_SIZE_Y(ScreenInfo)); 04842 #endif 04843 ScreenInfo->WindowMaximized = (wParam == SIZE_MAXIMIZED); 04844 04845 if (Console->ResizeFlags & SCREEN_BUFFER_CHANGE) { 04846 UpdateWindowSize(Console,ScreenInfo); 04847 } 04848 PositionConsoleWindow(Console, (Console->WindowRect.left == CW_USEDEFAULT)); 04849 #if defined(FE_IME) 04850 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 04851 { 04852 ConsoleImeResizeModeSystemView(Console,ScreenInfo->Window); 04853 ConsoleImeResizeCompStrView(Console,ScreenInfo->Window); 04854 } 04855 #endif // FE_IME 04856 #ifdef THERESES_DEBUG 04857 DbgPrint(" WindowRect is now %d %d %d %d\n",Console->WindowRect.left, 04858 Console->WindowRect.top, 04859 Console->WindowRect.right, 04860 Console->WindowRect.bottom); 04861 #endif 04862 if (Console->ResizeFlags & SCROLL_BAR_CHANGE) { 04863 InternalUpdateScrollBars(ScreenInfo); 04864 Console->ResizeFlags &= ~SCROLL_BAR_CHANGE; 04865 } 04866 } 04867 } else { 04868 04869 // 04870 // Console is going iconic. Trim working set of all 04871 // processes in the console 04872 // 04873 04874 TrimConsoleWorkingSet(Console); 04875 04876 } 04877 04878 break; 04879 case WM_DDE_ACK: 04880 if (Console->bIconInit) { 04881 Console->hWndProgMan = (HWND)wParam; 04882 } 04883 break; 04884 case WM_DDE_DATA: 04885 { 04886 DDEDATA *lpDDEData; 04887 LPPMICONDATA lpIconData; 04888 HICON hIcon; 04889 HANDLE hDdeData; 04890 BOOL bRelease; 04891 WPARAM atomTemp; 04892 04893 UnpackDDElParam(WM_DDE_DATA, lParam, (WPARAM *)&hDdeData, &atomTemp); 04894 04895 if (hDdeData == NULL) { 04896 break; 04897 } 04898 lpDDEData = (DDEDATA *)GlobalLock(hDdeData); 04899 ASSERT(lpDDEData->cfFormat == CF_TEXT); 04900 lpIconData = (LPPMICONDATA)lpDDEData->Value; 04901 hIcon = CreateIconFromResourceEx(&lpIconData->iResource, 04902 0, TRUE, 0x30000, 0, 0, LR_DEFAULTSIZE); 04903 if (hIcon) { 04904 if (Console->hIcon != NULL && Console->hIcon != ghDefaultIcon) { 04905 DestroyIcon(Console->hIcon); 04906 } 04907 Console->hIcon = hIcon; 04908 SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); 04909 04910 if (Console->hSmIcon != NULL) { 04911 if (Console->hSmIcon != ghDefaultSmIcon) { 04912 DestroyIcon(Console->hSmIcon); 04913 } 04914 Console->hSmIcon = NULL; 04915 SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)NULL); 04916 } 04917 } 04918 04919 if (lpDDEData->fAckReq) { 04920 04921 PostMessage(Console->hWndProgMan, 04922 WM_DDE_ACK, 04923 (WPARAM)hWnd, 04924 ReuseDDElParam(lParam, WM_DDE_DATA, WM_DDE_ACK, 0x8000, atomTemp)); 04925 } 04926 04927 bRelease = lpDDEData->fRelease; 04928 GlobalUnlock(hDdeData); 04929 if (bRelease){ 04930 GlobalFree(hDdeData); 04931 } 04932 PostMessage(Console->hWndProgMan, 04933 WM_DDE_TERMINATE, 04934 (WPARAM)hWnd, 04935 0 04936 ); 04937 if (Console->Flags & CONSOLE_IS_ICONIC) { 04938 // force repaint of icon 04939 InvalidateRect(hWnd, NULL, TRUE); 04940 } 04941 } 04942 break; 04943 case WM_ACTIVATE: 04944 04945 // 04946 // if we're activated by a mouse click, remember it so 04947 // we don't pass the click on to the app. 04948 // 04949 04950 if (LOWORD(wParam) == WA_CLICKACTIVE) { 04951 Console->Flags |= CONSOLE_IGNORE_NEXT_MOUSE_INPUT; 04952 } 04953 goto CallDefWin; 04954 break; 04955 case WM_DDE_TERMINATE: 04956 break; 04957 // FE_IME 04958 case CM_CONIME_KL_ACTIVATE: 04959 ActivateKeyboardLayout((HKL)wParam, KLF_SETFORPROCESS); 04960 break; 04961 case WM_INPUTLANGCHANGEREQUEST: 04962 if (CONSOLE_IS_IME_ENABLED()) { 04963 ULONG ConimeMessage; 04964 LRESULT lResult; 04965 04966 if (wParam & INPUTLANGCHANGE_BACKWARD) { 04967 ConimeMessage = CONIME_INPUTLANGCHANGEREQUESTBACKWARD; 04968 } 04969 else if (wParam & INPUTLANGCHANGE_FORWARD) { 04970 ConimeMessage = CONIME_INPUTLANGCHANGEREQUESTFORWARD; 04971 } 04972 else { 04973 ConimeMessage = CONIME_INPUTLANGCHANGEREQUEST; 04974 } 04975 04976 if (!NT_SUCCESS(ConsoleImeMessagePumpWorker(Console, 04977 ConimeMessage, 04978 (WPARAM)Console->ConsoleHandle, 04979 (LPARAM)lParam, 04980 &lResult)) || 04981 !lResult) { 04982 04983 break; 04984 } 04985 } 04986 #ifdef LATER 04987 else if (IS_IME_KBDLAYOUT(lParam)) { 04988 // IME keyboard layout should be avoided 04989 // if the console is not IME enabled. 04990 break; 04991 } 04992 // Call the default window proc and let it handle 04993 // the keyboard layout activation. 04994 #endif 04995 goto CallDefWin; 04996 04997 break; 04998 // end FE_IME 04999 05000 case WM_INPUTLANGCHANGE: 05001 Console->hklActive = (HKL)lParam; 05002 // FE_IME 05003 if (CONSOLE_IS_IME_ENABLED()) { 05004 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 05005 CONIME_INPUTLANGCHANGE, 05006 (WPARAM)Console->ConsoleHandle, 05007 (LPARAM)Console->hklActive 05008 ))) { 05009 break; 05010 } 05011 else{ 05012 GetImeKeyState(Console, NULL) ; 05013 } 05014 } 05015 // end FE_IME 05016 goto CallDefWin; 05017 05018 break; 05019 05020 case WM_SETFOCUS: 05021 ModifyConsoleProcessFocus(Console, TRUE); 05022 SetConsoleReserveKeys(hWnd, Console->ReserveKeys); 05023 Console->Flags |= CONSOLE_HAS_FOCUS; 05024 05025 SetTimer(hWnd, CURSOR_TIMER, guCaretBlinkTime, NULL); 05026 HandleFocusEvent(Console,TRUE); 05027 if (!Console->hklActive) { 05028 SystemParametersInfo(SPI_GETDEFAULTINPUTLANG, 0, &Console->hklActive, FALSE); 05029 GetNonBiDiKeyboardLayout(&Console->hklActive); 05030 } 05031 ActivateKeyboardLayout(Console->hklActive, 0); 05032 // FE_IME 05033 if (CONSOLE_IS_IME_ENABLED()) { 05034 // v-HirShi Sep.15.1995 Support Console IME 05035 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 05036 CONIME_SETFOCUS, 05037 (WPARAM)Console->ConsoleHandle, 05038 (LPARAM)Console->hklActive 05039 ))) { 05040 break; 05041 } 05042 05043 if (Console->InputBuffer.hWndConsoleIME) 05044 { 05045 /* 05046 * open property window by ImmConfigureIME 05047 * never set focus on console window 05048 * so, set focus to property window 05049 */ 05050 HWND hwnd = GetLastActivePopup(Console->InputBuffer.hWndConsoleIME); 05051 if (hwnd != NULL) 05052 SetForegroundWindow(hwnd); 05053 } 05054 } 05055 // FE_IME 05056 break; 05057 case WM_KILLFOCUS: 05058 ModifyConsoleProcessFocus(Console, FALSE); 05059 SetConsoleReserveKeys(hWnd, CONSOLE_NOSHORTCUTKEY); 05060 Console->Flags &= ~CONSOLE_HAS_FOCUS; 05061 05062 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 05063 ConsoleHideCursor(ScreenInfo); 05064 ScreenInfo->BufferInfo.TextInfo.UpdatingScreen -= 1; // counteract HideCursor 05065 } 05066 KillTimer(hWnd, CURSOR_TIMER); 05067 HandleFocusEvent(Console,FALSE); 05068 05069 // FE_IME 05070 if (CONSOLE_IS_IME_ENABLED()) { 05071 // v-HirShi Sep.16.1995 Support Console IME 05072 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 05073 CONIME_KILLFOCUS, 05074 (WPARAM)Console->ConsoleHandle, 05075 (LPARAM)NULL 05076 ))) { 05077 break; 05078 } 05079 } 05080 // end FE_IME 05081 break; 05082 case WM_PAINT: 05083 05084 // ICONIC bit is not set if we're fullscreen and don't 05085 // have the hardware 05086 05087 ConsoleHideCursor(ScreenInfo); 05088 hDC = BeginPaint(hWnd, &ps); 05089 if (Console->Flags & CONSOLE_IS_ICONIC || 05090 Console->FullScreenFlags == CONSOLE_FULLSCREEN) { 05091 RECT rc; 05092 UINT cxIcon, cyIcon; 05093 GetClientRect(hWnd, &rc); 05094 cxIcon = GetSystemMetrics(SM_CXICON); 05095 cyIcon = GetSystemMetrics(SM_CYICON); 05096 05097 rc.left = (rc.right - cxIcon) >> 1; 05098 rc.top = (rc.bottom - cyIcon) >> 1; 05099 05100 DrawIcon(hDC, rc.left, rc.top, Console->hIcon); 05101 } else { 05102 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 05103 PaintRect.Left = (SHORT)((ps.rcPaint.left/SCR_FONTSIZE(ScreenInfo).X)+ScreenInfo->Window.Left); 05104 PaintRect.Right = (SHORT)((ps.rcPaint.right/SCR_FONTSIZE(ScreenInfo).X)+ScreenInfo->Window.Left); 05105 PaintRect.Top = (SHORT)((ps.rcPaint.top/SCR_FONTSIZE(ScreenInfo).Y)+ScreenInfo->Window.Top); 05106 PaintRect.Bottom = (SHORT)((ps.rcPaint.bottom/SCR_FONTSIZE(ScreenInfo).Y)+ScreenInfo->Window.Top); 05107 } else { 05108 PaintRect.Left = (SHORT)(ps.rcPaint.left+ScreenInfo->Window.Left); 05109 PaintRect.Right = (SHORT)(ps.rcPaint.right+ScreenInfo->Window.Left); 05110 PaintRect.Top = (SHORT)(ps.rcPaint.top+ScreenInfo->Window.Top); 05111 PaintRect.Bottom = (SHORT)(ps.rcPaint.bottom+ScreenInfo->Window.Top); 05112 } 05113 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 05114 WriteToScreen(ScreenInfo,&PaintRect); 05115 } 05116 EndPaint(hWnd,&ps); 05117 ConsoleShowCursor(ScreenInfo); 05118 break; 05119 case WM_CLOSE: 05120 if (!(Console->Flags & CONSOLE_NO_WINDOW) || 05121 !(Console->Flags & CONSOLE_WOW_REGISTERED)) { 05122 HandleCtrlEvent(Console,CTRL_CLOSE_EVENT); 05123 } 05124 break; 05125 case WM_ERASEBKGND: 05126 05127 // ICONIC bit is not set if we're fullscreen and don't 05128 // have the hardware 05129 05130 if (Console->Flags & CONSOLE_IS_ICONIC || 05131 Console->FullScreenFlags == CONSOLE_FULLSCREEN) { 05132 Message = WM_ICONERASEBKGND; 05133 goto CallDefWin; 05134 } 05135 break; 05136 case WM_SETTINGCHANGE: 05137 /* 05138 * See if the caret blink time was changed. If so, reset the 05139 * timer. 05140 */ 05141 if (wParam == SPI_SETKEYBOARDDELAY) { 05142 guCaretBlinkTime = GetCaretBlinkTime(); 05143 if (Console->Flags & CONSOLE_HAS_FOCUS) { 05144 KillTimer(hWnd, CURSOR_TIMER); 05145 SetTimer(hWnd, CURSOR_TIMER, guCaretBlinkTime, NULL); 05146 } 05147 } else { 05148 gfInitSystemMetrics = TRUE; 05149 } 05150 break; 05151 case WM_DISPLAYCHANGE: 05152 gfInitSystemMetrics = TRUE; 05153 break; 05154 case WM_SETCURSOR: 05155 if (lParam == -1) { 05156 05157 // 05158 // the app changed the cursor visibility or shape. 05159 // see if the cursor is in the client area. 05160 // 05161 05162 POINT Point; 05163 HWND hWndTmp; 05164 GetCursorPos(&Point); 05165 hWndTmp = WindowFromPoint(Point); 05166 if (hWndTmp == hWnd) { 05167 lParam = DefWindowProc(hWnd,WM_NCHITTEST,0,MAKELONG((WORD)Point.x, (WORD)Point.y)); 05168 } 05169 } 05170 if ((WORD)lParam == HTCLIENT) { 05171 if (ScreenInfo->CursorDisplayCount < 0) { 05172 SetCursor(NULL); 05173 } else { 05174 SetCursor(ScreenInfo->CursorHandle); 05175 } 05176 } else { 05177 goto CallDefWin; 05178 } 05179 break; 05180 case WM_GETMINMAXINFO: 05181 { 05182 LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; 05183 COORD FontSize; 05184 WINDOW_LIMITS WindowLimits; 05185 05186 GetWindowLimits(ScreenInfo, &WindowLimits); 05187 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 05188 FontSize = SCR_FONTSIZE(ScreenInfo); 05189 } else { 05190 FontSize.X = 1; 05191 FontSize.Y = 1; 05192 } 05193 lpmmi->ptMaxSize.x = lpmmi->ptMaxTrackSize.x = WindowLimits.MaxWindow.X; 05194 if (!ScreenInfo->WindowMaximizedY) { 05195 lpmmi->ptMaxTrackSize.x += VerticalScrollSize; 05196 lpmmi->ptMaxSize.x += VerticalScrollSize; 05197 } 05198 while (lpmmi->ptMaxSize.x > WindowLimits.FullScreenSize.X + VerticalClientToWindow) { 05199 lpmmi->ptMaxSize.x -= FontSize.X; 05200 } 05201 lpmmi->ptMaxSize.y = lpmmi->ptMaxTrackSize.y = WindowLimits.MaxWindow.Y; 05202 if (!ScreenInfo->WindowMaximizedX) { 05203 lpmmi->ptMaxTrackSize.y += HorizontalScrollSize; 05204 lpmmi->ptMaxSize.y += HorizontalScrollSize; 05205 } 05206 while (lpmmi->ptMaxSize.y > WindowLimits.FullScreenSize.Y + HorizontalClientToWindow) { 05207 lpmmi->ptMaxSize.y -= FontSize.Y; 05208 } 05209 lpmmi->ptMinTrackSize.x = WindowLimits.MinimumWindowSize.X * FontSize.X + VerticalClientToWindow; 05210 lpmmi->ptMinTrackSize.y = HorizontalClientToWindow; 05211 } 05212 break; 05213 case WM_QUERYDRAGICON: 05214 Status = (LRESULT)Console->hIcon; 05215 break; 05216 case WM_WINDOWPOSCHANGING: 05217 // ignore window pos changes if going fullscreen 05218 if (TRUE || (Console->FullScreenFlags == 0)) { 05219 LPWINDOWPOS WindowPos = (LPWINDOWPOS)lParam; 05220 DWORD fMinimized; 05221 05222 /* 05223 * This message is sent before a SetWindowPos() operation 05224 * occurs. We use it here to set/clear the CONSOLE_IS_ICONIC 05225 * bit appropriately... doing so in the WM_SIZE handler 05226 * is incorrect because the WM_SIZE comes after the 05227 * WM_ERASEBKGND during SetWindowPos() processing, and the 05228 * WM_ERASEBKGND needs to know if the console window is 05229 * iconic or not. 05230 */ 05231 fMinimized = IsIconic(hWnd); 05232 05233 if (fMinimized) { 05234 if (!(Console->Flags & CONSOLE_IS_ICONIC)) { 05235 Console->Flags |= CONSOLE_IS_ICONIC; 05236 05237 // 05238 // if the palette is something other than default, 05239 // select the default palette in. otherwise, the 05240 // screen will repaint twice each time the icon 05241 // is painted. 05242 // 05243 05244 if (ScreenInfo->hPalette != NULL && 05245 Console->FullScreenFlags == 0) { 05246 SelectPalette(Console->hDC, 05247 Console->hSysPalette, 05248 FALSE); 05249 UnsetActivePalette(ScreenInfo); 05250 } 05251 } 05252 } else { 05253 if (Console->Flags & CONSOLE_IS_ICONIC) { 05254 Console->Flags &= ~CONSOLE_IS_ICONIC; 05255 05256 // 05257 // if the palette is something other than default, 05258 // select the default palette in. otherwise, the 05259 // screen will repaint twice each time the icon 05260 // is painted. 05261 // 05262 05263 if (ScreenInfo->hPalette != NULL && 05264 Console->FullScreenFlags == 0) { 05265 SelectPalette(Console->hDC, 05266 ScreenInfo->hPalette, 05267 FALSE); 05268 SetActivePalette(ScreenInfo); 05269 } 05270 } 05271 } 05272 if (!ScreenInfo->ResizingWindow && 05273 (WindowPos->cx || WindowPos->cy) && 05274 !fMinimized) { 05275 ProcessResizeWindow(ScreenInfo,Console,WindowPos); 05276 } 05277 } 05278 break; 05279 case WM_CONTEXTMENU: 05280 if (DefWindowProc(hWnd, WM_NCHITTEST, 0, lParam) == HTCLIENT) { 05281 TrackPopupMenuEx(Console->hHeirMenu, 05282 TPM_RIGHTBUTTON, 05283 GET_X_LPARAM(lParam), 05284 GET_Y_LPARAM(lParam), 05285 hWnd, 05286 NULL); 05287 } else { 05288 goto CallDefWin; 05289 } 05290 break; 05291 case WM_NCLBUTTONDOWN: 05292 // allow user to move window even when bigger than the screen 05293 switch (wParam & 0x00FF) { 05294 case HTCAPTION: 05295 UnlockConsole(Console); 05296 Console = NULL; 05297 SetActiveWindow(hWnd); 05298 SendMessage(hWnd, WM_SYSCOMMAND, 05299 SC_MOVE | wParam, lParam); 05300 break; 05301 default: 05302 goto CallDefWin; 05303 } 05304 break; 05305 #if defined (FE_IME) 05306 // Sep.16.1995 Support Console IME 05307 case WM_KEYDOWN +CONIME_KEYDATA: 05308 case WM_KEYUP +CONIME_KEYDATA: 05309 case WM_CHAR +CONIME_KEYDATA: 05310 case WM_DEADCHAR +CONIME_KEYDATA: 05311 05312 case WM_SYSKEYDOWN +CONIME_KEYDATA: 05313 case WM_SYSKEYUP +CONIME_KEYDATA: 05314 case WM_SYSCHAR +CONIME_KEYDATA: 05315 case WM_SYSDEADCHAR+CONIME_KEYDATA: 05316 #endif 05317 case WM_KEYDOWN: 05318 case WM_KEYUP: 05319 case WM_CHAR: 05320 case WM_DEADCHAR: 05321 HandleKeyEvent(Console,hWnd,Message,wParam,lParam); 05322 break; 05323 case WM_SYSKEYDOWN: 05324 case WM_SYSKEYUP: 05325 case WM_SYSCHAR: 05326 case WM_SYSDEADCHAR: 05327 if (HandleSysKeyEvent(Console,hWnd,Message,wParam,lParam) && Console != NULL) { 05328 goto CallDefWin; 05329 } 05330 break; 05331 case WM_COMMAND: 05332 // 05333 // If this is an edit command from the context menu, treat 05334 // it like a sys command. 05335 // 05336 if ((wParam < cmCopy) || (wParam > cmSelectAll)) { 05337 break; 05338 } 05339 // FALL THRU 05340 case WM_SYSCOMMAND: 05341 if (wParam >= ScreenInfo->CommandIdLow && 05342 wParam <= ScreenInfo->CommandIdHigh) { 05343 HandleMenuEvent(Console,(DWORD)wParam); 05344 } else if (wParam == cmMark) { 05345 DoMark(Console); 05346 } else if (wParam == cmCopy) { 05347 DoCopy(Console); 05348 } else if (wParam == cmPaste) { 05349 DoPaste(Console); 05350 } else if (wParam == cmScroll) { 05351 DoScroll(Console); 05352 } else if (wParam == cmFind) { 05353 DoFind(Console); 05354 } else if (wParam == cmSelectAll) { 05355 DoSelectAll(Console); 05356 } else if (wParam == cmControl) { 05357 PropertiesDlgShow(Console, TRUE); 05358 } else if (wParam == cmDefaults) { 05359 PropertiesDlgShow(Console, FALSE); 05360 } else { 05361 05362 // if we're restoring, remove any 05363 // mouse events so app doesn't get them. 05364 05365 if (wParam == SC_RESTORE) { 05366 MSG RestoreMsg; 05367 SetCapture(hWnd); 05368 while (GetCapture() != NULL && 05369 (GetKeyState(VK_LBUTTON) & KEY_PRESSED)) { 05370 PeekMessage(&RestoreMsg, 05371 hWnd, 05372 WM_MOUSEFIRST, 05373 WM_MOUSELAST, 05374 PM_REMOVE 05375 ); 05376 } 05377 ReleaseCapture(); 05378 } 05379 05380 goto CallDefWin; 05381 } 05382 break; 05383 case WM_TIMER: 05384 #if defined(FE_IME) 05385 if (wParam == SCROLL_WAIT_TIMER) 05386 { 05387 ASSERT(CONSOLE_IS_IME_ENABLED()); 05388 if ((ScreenInfo->Console->ConsoleIme.ScrollFlag & (HIDE_FOR_SCROLL)) && 05389 (ScreenInfo->Console->ConsoleIme.ScrollWaitCountDown > 0) 05390 ) { 05391 if ((ScreenInfo->Console->ConsoleIme.ScrollWaitCountDown -= guCaretBlinkTime) <= 0) { 05392 ConsoleImeBottomLineInUse(ScreenInfo); 05393 } 05394 } 05395 break; 05396 } 05397 #endif // FE_IME 05398 CursorTimerRoutine(ScreenInfo); 05399 ScrollIfNecessary(Console,ScreenInfo); 05400 break; 05401 case WM_HSCROLL: 05402 HorizontalScroll(ScreenInfo, LOWORD(wParam), HIWORD(wParam)); 05403 break; 05404 case WM_VSCROLL: 05405 VerticalScroll(Console, ScreenInfo,LOWORD(wParam),HIWORD(wParam)); 05406 break; 05407 case WM_INITMENU: 05408 HandleMenuEvent(Console,WM_INITMENU); 05409 InitializeMenu(Console); 05410 break; 05411 case WM_MENUSELECT: 05412 if (HIWORD(wParam) == 0xffff) { 05413 HandleMenuEvent(Console,WM_MENUSELECT); 05414 } 05415 break; 05416 case WM_MOUSEMOVE: 05417 case WM_LBUTTONDOWN: 05418 case WM_LBUTTONUP: 05419 case WM_LBUTTONDBLCLK: 05420 case WM_RBUTTONDOWN: 05421 case WM_RBUTTONUP: 05422 case WM_RBUTTONDBLCLK: 05423 case WM_MBUTTONDOWN: 05424 case WM_MBUTTONUP: 05425 case WM_MBUTTONDBLCLK: 05426 case WM_MOUSEWHEEL: 05427 if (HandleMouseEvent(Console,ScreenInfo,Message,wParam,lParam)) { 05428 if (Message != WM_MOUSEWHEEL) { 05429 goto CallDefWin; 05430 } 05431 } else { 05432 break; 05433 } 05434 05435 /* 05436 * Don't handle zoom 05437 */ 05438 if (wParam & (MK_CONTROL)) { 05439 goto CallDefWin; 05440 } 05441 05442 Status = 1; 05443 if (gfInitSystemMetrics) { 05444 InitializeSystemMetrics(); 05445 } 05446 05447 ScreenInfo->WheelDelta -= (short)HIWORD(wParam); 05448 if (abs(ScreenInfo->WheelDelta) >= WHEEL_DELTA && 05449 gucWheelScrollLines > 0) { 05450 05451 COORD NewOrigin; 05452 SHORT dy; 05453 05454 NewOrigin.X = ScreenInfo->Window.Left; 05455 NewOrigin.Y = ScreenInfo->Window.Top; 05456 05457 /* 05458 * Limit a roll of one (1) WHEEL_DELTA to scroll one (1) page. 05459 * If in shift scroll mode then scroll one page at a time regardless. 05460 */ 05461 05462 if (!(wParam & MK_SHIFT)) 05463 dy = (int) min( 05464 (UINT) CONSOLE_WINDOW_SIZE_Y(ScreenInfo) - 1, 05465 gucWheelScrollLines); 05466 else 05467 dy = CONSOLE_WINDOW_SIZE_Y(ScreenInfo) - 1; 05468 05469 if (dy == 0) { 05470 dy++; 05471 } 05472 05473 dy *= (ScreenInfo->WheelDelta / WHEEL_DELTA); 05474 ScreenInfo->WheelDelta %= WHEEL_DELTA; 05475 05476 NewOrigin.Y += dy; 05477 if (NewOrigin.Y < 0) { 05478 NewOrigin.Y = 0; 05479 } else if (NewOrigin.Y + CONSOLE_WINDOW_SIZE_Y(ScreenInfo) > 05480 ScreenInfo->ScreenBufferSize.Y) { 05481 NewOrigin.Y = ScreenInfo->ScreenBufferSize.Y - 05482 CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 05483 } 05484 05485 SetWindowOrigin(ScreenInfo, TRUE, NewOrigin); 05486 } 05487 break; 05488 05489 case WM_PALETTECHANGED: 05490 if (Console->FullScreenFlags == 0) { 05491 if (ScreenInfo->hPalette != NULL) { 05492 SetActivePalette(ScreenInfo); 05493 if (ScreenInfo->Flags & CONSOLE_GRAPHICS_BUFFER) { 05494 WriteRegionToScreenBitMap(ScreenInfo, 05495 &ScreenInfo->Window); 05496 } 05497 } else { 05498 SetScreenColors(ScreenInfo, ScreenInfo->Attributes, 05499 ScreenInfo->PopupAttributes, TRUE); 05500 } 05501 } 05502 break; 05503 #if defined(_X86_) 05504 case WM_FULLSCREEN: 05505 05506 // 05507 // This message is sent by the system to tell console that 05508 // the fullscreen state of a window has changed. 05509 // In some cases, this message will be sent in response to 05510 // a call from console to change to fullscreen (Atl-Enter) 05511 // or may also come directly from the system (switch of 05512 // focus from a windowed app to a fullscreen app). 05513 // 05514 05515 KdPrint(("CONSRV: WindowProc - WM_FULLSCREEN\n")); 05516 05517 Status = DisplayModeTransition(wParam,Console,ScreenInfo); 05518 #if defined(FE_IME) 05519 if (NT_SUCCESS(Status)) { 05520 Status = ImeWmFullScreen(wParam,Console,ScreenInfo); 05521 } 05522 #endif // FE_IME 05523 break; 05524 #endif 05525 case CM_SET_WINDOW_SIZE: 05526 if (lParam == 0x47474747) { 05527 Status = InternalSetWindowSize(Console, 05528 (PSCREEN_INFORMATION)wParam, 05529 &ScreenInfo->Window 05530 ); 05531 } 05532 break; 05533 case CM_BEEP: 05534 if (lParam == 0x47474747) { 05535 Beep(800, 200); 05536 } 05537 break; 05538 case CM_UPDATE_SCROLL_BARS: 05539 InternalUpdateScrollBars(ScreenInfo); 05540 break; 05541 case CM_UPDATE_TITLE: 05542 SetWindowText(hWnd,Console->Title); 05543 break; 05544 case CM_CONSOLE_MSG: 05545 if (!UnqueueConsoleMessage(Console, &Message, &wParam, &lParam)) { 05546 break; 05547 } 05548 switch (Message) { 05549 #if defined(_X86_) 05550 case CM_MODE_TRANSITION: 05551 05552 KdPrint(("CONSRV: WindowProc - CM_MODE_TRANSITION\n")); 05553 05554 if (wParam == FULLSCREEN) { 05555 if (Console->FullScreenFlags == 0) { 05556 ConvertToFullScreen(Console); 05557 Console->FullScreenFlags |= CONSOLE_FULLSCREEN; 05558 ChangeDispSettings(Console, hWnd, CDS_FULLSCREEN); 05559 } 05560 } else { 05561 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 05562 ConvertToWindowed(Console); 05563 Console->FullScreenFlags &= ~CONSOLE_FULLSCREEN; 05564 ChangeDispSettings(Console, hWnd, 0); 05565 05566 ShowWindow(hWnd, SW_RESTORE); 05567 } 05568 } 05569 05570 UnlockConsole(Console); 05571 Console = NULL; 05572 05573 NtSetEvent((HANDLE)lParam, NULL); 05574 NtClose((HANDLE)lParam); 05575 break; 05576 #endif 05577 #if defined (FE_IME) 05578 case CM_SET_IME_CODEPAGE: { 05579 if (! LOWORD(lParam)) 05580 { 05581 // Input code page 05582 Status = SetImeCodePage(Console); 05583 } 05584 else 05585 { 05586 // Output code page 05587 Status = SetImeOutputCodePage(Console, ScreenInfo, HIWORD(lParam)); 05588 } 05589 05590 if (wParam) { 05591 NtSetEvent((HANDLE)wParam, NULL); 05592 NtClose((HANDLE)wParam); 05593 } 05594 break; 05595 } 05596 case CM_SET_NLSMODE: 05597 Status = SetImeKeyState(Console, ImmConversionFromConsole((DWORD)lParam)); 05598 if (wParam) { 05599 NtSetEvent((HANDLE)wParam, NULL); 05600 NtClose((HANDLE)wParam); 05601 } 05602 break; 05603 case CM_GET_NLSMODE: 05604 if (Console->InputThreadInfo->hWndConsoleIME) 05605 { 05606 ASSERT(CONSOLE_IS_IME_ENABLED()); 05607 05608 if (!NT_SUCCESS(GetImeKeyState(Console, NULL))) { 05609 if (wParam) { 05610 NtSetEvent((HANDLE)wParam, NULL); 05611 NtClose((HANDLE)wParam); 05612 } 05613 break; 05614 } 05615 if (wParam) { 05616 NtSetEvent((HANDLE)wParam, NULL); 05617 NtClose((HANDLE)wParam); 05618 } 05619 } 05620 else if (lParam < 10) 05621 { 05622 /* 05623 * try get conversion mode until ready ConIME. 05624 */ 05625 Status = QueueConsoleMessage(Console, 05626 CM_GET_NLSMODE, 05627 wParam, 05628 lParam+1 05629 ); 05630 if (!NT_SUCCESS(Status)) { 05631 if (wParam) { 05632 NtSetEvent((HANDLE)wParam, NULL); 05633 NtClose((HANDLE)wParam); 05634 } 05635 } 05636 } 05637 else 05638 { 05639 if (wParam) { 05640 NtSetEvent((HANDLE)wParam, NULL); 05641 NtClose((HANDLE)wParam); 05642 } 05643 } 05644 break; 05645 #endif // FE_IME 05646 } 05647 break; 05648 05649 case CM_HIDE_WINDOW: 05650 ShowWindowAsync(hWnd, SW_MINIMIZE); 05651 break; 05652 case CM_PROPERTIES_START: 05653 Console->hWndProperties = (HWND)wParam; 05654 break; 05655 case CM_PROPERTIES_UPDATE: 05656 PropertiesUpdate(Console, (HANDLE)wParam); 05657 break; 05658 case CM_PROPERTIES_END: 05659 Console->hWndProperties = NULL; 05660 break; 05661 #if defined(FE_IME) 05662 case WM_COPYDATA: 05663 if (CONSOLE_IS_IME_ENABLED() && CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 05664 Status = ImeControl(Console,(HWND)wParam,(PCOPYDATASTRUCT)lParam); 05665 } 05666 break; 05667 // v-HirShi Sep.18.1995 Support Console IME 05668 case WM_ENTERMENULOOP: 05669 if (Console->Flags & CONSOLE_HAS_FOCUS) { 05670 Console->InputBuffer.ImeMode.Unavailable = TRUE; 05671 if (CONSOLE_IS_IME_ENABLED()) { 05672 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 05673 CONIME_KILLFOCUS, 05674 (WPARAM)Console->ConsoleHandle, 05675 (LPARAM)NULL 05676 ))) { 05677 break; 05678 } 05679 } 05680 } 05681 break; 05682 05683 case WM_EXITMENULOOP: 05684 if (Console->Flags & CONSOLE_HAS_FOCUS) { 05685 if (CONSOLE_IS_IME_ENABLED()) { 05686 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 05687 CONIME_SETFOCUS, 05688 (WPARAM)Console->ConsoleHandle, 05689 (LPARAM)Console->hklActive 05690 ))) { 05691 break; 05692 } 05693 } 05694 Console->InputBuffer.ImeMode.Unavailable = FALSE; 05695 } 05696 break; 05697 05698 case WM_ENTERSIZEMOVE: 05699 if (Console->Flags & CONSOLE_HAS_FOCUS) { 05700 Console->InputBuffer.ImeMode.Unavailable = TRUE; 05701 } 05702 break; 05703 05704 case WM_EXITSIZEMOVE: 05705 if (Console->Flags & CONSOLE_HAS_FOCUS) { 05706 Console->InputBuffer.ImeMode.Unavailable = FALSE; 05707 } 05708 break; 05709 #endif // FE_IME 05710 CallDefWin: 05711 default: 05712 if (Console != NULL) { 05713 UnlockConsole(Console); 05714 Console = NULL; 05715 } 05716 Status = (DefWindowProc(hWnd,Message,wParam,lParam)); 05717 break; 05718 } 05719 } 05720 } finally { 05721 if (Console != NULL) { 05722 UnlockConsole(Console); 05723 Console = NULL; 05724 } 05725 } 05726 05727 return Status; 05728 }

int ConvertInputToUnicode IN UINT  Codepage,
IN LPSTR  Source,
IN int  SourceLength,
OUT LPWSTR  Target,
IN int  TargetLength
 

Definition at line 1345 of file w32/ntcon/server/misc.c.

References DBGCHARS, NT_SUCCESS, NTSTATUS(), OEMCP, RtlOemToUnicodeN(), and Status.

Referenced by AddExeAliasList(), FindExe(), FindExeCommandHistory(), SrvAddConsoleAlias(), SrvGetConsoleAlias(), and SrvSetConsoleTitle().

01355 { 01356 DBGCHARS(("ConvertInputToUnicode %d->U %.*s\n", Codepage, 01357 SourceLength > 10 ? 10 : SourceLength, Source)); 01358 if (Codepage == OEMCP) { 01359 ULONG Length; 01360 NTSTATUS Status; 01361 01362 Status = RtlOemToUnicodeN(Target, 01363 TargetLength * sizeof(WCHAR), 01364 &Length, 01365 Source, 01366 SourceLength 01367 ); 01368 if (!NT_SUCCESS(Status)) { 01369 return 0; 01370 } else { 01371 return Length / sizeof(WCHAR); 01372 } 01373 } else { 01374 return MultiByteToWideChar(Codepage, 01375 0, 01376 Source, 01377 SourceLength, 01378 Target, 01379 TargetLength); 01380 } 01381 }

int ConvertOutputToOem IN UINT  Codepage,
IN LPWSTR  Source,
IN int  SourceLength,
OUT LPSTR  Target,
IN int  TargetLength
 

Definition at line 1508 of file w32/ntcon/server/misc.c.

References ASSERT, CHAR, ConsoleHeapAlloc, ConsoleHeapFree, DBGCHARS, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, RtlUnicodeToOemN(), STACK_BUFFER_SIZE, Status, and TMP_TAG.

Referenced by ReadOutputString(), and TranslateOutputToOem().

01521 { 01522 if (Codepage == OEMCP) { 01523 NTSTATUS Status; 01524 ULONG Length; 01525 // Can do this in place 01526 Status = RtlUnicodeToOemN(Target, 01527 TargetLength, 01528 &Length, 01529 Source, 01530 SourceLength * sizeof(WCHAR) 01531 ); 01532 if (NT_SUCCESS(Status)) { 01533 return Length; 01534 } else { 01535 return 0; 01536 } 01537 } else { 01538 ASSERT (Source != (LPWSTR)Target); 01539 #ifdef SOURCE_EQ_TARGET 01540 LPSTR pszDestTmp; 01541 CHAR StackBuffer[STACK_BUFFER_SIZE]; 01542 01543 DBGCHARS(("ConvertOutputToOem U->%d %.*ls\n", Codepage, 01544 SourceLength > 10 ? 10 : SourceLength, Source)); 01545 01546 if (TargetLength > STACK_BUFFER_SIZE) { 01547 pszDestTmp = (LPSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),TargetLength); 01548 if (pszDestTmp == NULL) { 01549 return 0; 01550 } 01551 } else { 01552 pszDestTmp = StackBuffer; 01553 } 01554 TargetLength = WideCharToMultiByte(Codepage, 0, 01555 Source, SourceLength, 01556 pszDestTmp, TargetLength, NULL, NULL); 01557 01558 RtlCopyMemory(Target, pszDestTmp, TargetLength); 01559 if (pszDestTmp != StackBuffer) { 01560 ConsoleHeapFree(pszDestTmp); 01561 } 01562 return TargetLength; 01563 #else 01564 DBGCHARS(("ConvertOutputToOem U->%d %.*ls\n", Codepage, 01565 SourceLength > 10 ? 10 : SourceLength, Source)); 01566 return WideCharToMultiByte(Codepage, 0, 01567 Source, SourceLength, Target, TargetLength, NULL, NULL); 01568 #endif 01569 } 01570 }

int ConvertOutputToUnicode IN UINT  Codepage,
IN LPSTR  Source,
IN int  SourceLength,
OUT LPWSTR  Target,
IN int  TargetLength
 

Definition at line 1384 of file w32/ntcon/server/misc.c.

References CHAR, ConsoleHeapAlloc, ConsoleHeapFree, DBGCHARS, GlyphCP, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, RtlCustomCPToUnicodeN(), STACK_BUFFER_SIZE, Status, and TMP_TAG.

Referenced by WWSB_DoSrvWriteConsole(), WWSB_FillOutput(), WWSB_WriteChars(), WWSB_WriteOutputString(), and WWSB_WriteRectToScreenBuffer().

01396 { 01397 NTSTATUS Status; 01398 ULONG Length; 01399 CHAR StackBuffer[STACK_BUFFER_SIZE]; 01400 LPSTR pszT; 01401 01402 DBGCHARS(("ConvertOutputToUnicode %d->U %.*s\n", Codepage, 01403 SourceLength > 10 ? 10 : SourceLength, Source)); 01404 if (Codepage == OEMCP) { 01405 Status = RtlCustomCPToUnicodeN(&GlyphCP, 01406 Target, 01407 TargetLength * sizeof(WCHAR), 01408 &Length, 01409 Source, 01410 SourceLength 01411 ); 01412 if (!NT_SUCCESS(Status)) { 01413 return 0; 01414 } else { 01415 return Length / sizeof(WCHAR); 01416 } 01417 } 01418 01419 if (TargetLength > STACK_BUFFER_SIZE) { 01420 pszT = (LPSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),SourceLength); 01421 if (pszT == NULL) { 01422 return 0; 01423 } 01424 } else { 01425 pszT = StackBuffer; 01426 } 01427 RtlCopyMemory(pszT, Source, SourceLength); 01428 Length = MultiByteToWideChar(Codepage, MB_USEGLYPHCHARS, 01429 pszT, SourceLength, Target, TargetLength); 01430 if (pszT != StackBuffer) { 01431 ConsoleHeapFree(pszT); 01432 } 01433 return Length; 01434 }

VOID ConvertToMouseSelect IN PCONSOLE_INFORMATION  Console,
IN COORD  MousePosition
 

Definition at line 390 of file ntcon/server/clipbrd.c.

References CancelKeySelection(), CONSOLE_MOUSE_DOWN, CONSOLE_MOUSE_SELECTION, CONSOLE_SELECTION_NOT_EMPTY, FALSE, msgMarkMode, msgSelectMode, MyInvert(), SetCapture, SetWinText(), and TRUE.

Referenced by HandleMouseEvent().

00401 { 00402 Console->SelectionFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; 00403 00404 // 00405 // undo key selection 00406 // 00407 00408 CancelKeySelection(Console,TRUE); 00409 00410 Console->SelectionFlags |= CONSOLE_SELECTION_NOT_EMPTY; 00411 00412 // 00413 // invert new selection 00414 // 00415 00416 Console->SelectionAnchor = MousePosition; 00417 Console->SelectionRect.Left =Console->SelectionRect.Right = Console->SelectionAnchor.X; 00418 Console->SelectionRect.Top = Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 00419 MyInvert(Console,&Console->SelectionRect); 00420 00421 // 00422 // update title bar 00423 // 00424 00425 SetWinText(Console,msgMarkMode,FALSE); 00426 SetWinText(Console,msgSelectMode,TRUE); 00427 00428 // 00429 // capture mouse movement 00430 // 00431 00432 SetCapture(Console->hWnd); 00433 }

int ConvertToOem IN UINT  Codepage,
IN LPWSTR  Source,
IN int  SourceLength,
OUT LPSTR  Target,
IN int  TargetLength
 

Definition at line 1307 of file w32/ntcon/server/misc.c.

References DBGCHARS, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, RtlUnicodeToOemN(), and Status.

Referenced by CookedRead(), DoStringPaste(), ProcessCommandListInput(), RawReadWaitRoutine(), ReadChars(), SrvGetConsoleAlias(), SrvGetConsoleAliases(), SrvGetConsoleAliasExes(), SrvGetConsoleCommandHistory(), and SrvGetConsoleTitle().

01314 { 01315 DBGCHARS(("ConvertToOem U->%d %.*ls\n", Codepage, 01316 SourceLength > 10 ? 10 : SourceLength, Source)); 01317 if (Codepage == OEMCP) { 01318 ULONG Length; 01319 NTSTATUS Status; 01320 01321 Status = RtlUnicodeToOemN(Target, 01322 TargetLength, 01323 &Length, 01324 Source, 01325 SourceLength * sizeof(WCHAR) 01326 ); 01327 if (!NT_SUCCESS(Status)) { 01328 return 0; 01329 } else { 01330 return Length; 01331 } 01332 } else { 01333 return WideCharToMultiByte(Codepage, 01334 0, 01335 Source, 01336 SourceLength, 01337 Target, 01338 TargetLength, 01339 NULL, 01340 NULL); 01341 } 01342 }

NTSTATUS CookedRead IN PCOOKED_READ_DATA  CookedReadData,
IN PCSR_API_MSG  WaitReplyMessage,
IN PCSR_THREAD  WaitingThread,
IN BOOLEAN  WaitRoutine
 

Definition at line 1237 of file server/stream.c.

References AddCommand(), ASSERT, BOOL, _HANDLE_DATA::Buffer, _INPUT_READ_HANDLE_DATA::BufPtr, _INPUT_READ_HANDLE_DATA::BytesAvailable, CloseOutputHandle(), CONSOLE_FROMTHREADPERPROCESSDATA, CONSOLE_HISTORY_NODUP, CONSOLE_IGNORE_NEXT_KEYUP, CONSOLE_STATUS_READ_COMPLETE, CONSOLE_STATUS_WAIT, CONSOLE_STATUS_WAIT_NO_BLOCK, ConsoleHeapAlloc, ConsoleHeapFree, _CONSOLE_READCONSOLE_MSG::ControlKeyState, ConvertToOem(), CookedReadWaitRoutine(), _INPUT_READ_HANDLE_DATA::CurrentBufPtr, DereferenceIoHandleNoCheck(), DWORD, FALSE, GetChar(), HANDLE_INPUT_PENDING, HANDLE_MULTI_LINE_INPUT, _INPUT_READ_HANDLE_DATA::InputHandleFlags, _HANDLE_DATA::InputReadData, MAKE_TAG, MatchandCopyAlias(), NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_READCONSOLE_MSG::NumBytes, PBYTE, ProcessCommandLine(), ProcessCookedReadInput(), PUSHORT, Status, StringLength(), TMP_TAG, TranslateUnicodeToOem(), TRUE, _CONSOLE_READCONSOLE_MSG::Unicode, UNICODE_CARRIAGERETURN, UNICODE_LINEFEED, USHORT, and WaitForMoreToRead().

Referenced by CookedReadWaitRoutine(), and ReadChars().

01243 { 01244 WCHAR Char; 01245 BOOLEAN CommandLineEditingKeys,EnableScrollMode; 01246 DWORD KeyState; 01247 NTSTATUS Status=STATUS_SUCCESS; 01248 PCONSOLE_READCONSOLE_MSG a; 01249 PHANDLE_DATA HandleData; 01250 #ifdef FE_SB 01251 DWORD NumBytes; 01252 ULONG NumToWrite; 01253 BOOL fAddDbcsLead = FALSE; 01254 #endif 01255 01256 Status = DereferenceIoHandleNoCheck(CookedReadData->ProcessData, 01257 CookedReadData->HandleIndex, 01258 &HandleData 01259 ); 01260 ASSERT (NT_SUCCESS(Status)); 01261 a = (PCONSOLE_READCONSOLE_MSG)&WaitReplyMessage->u.ApiMessageData; 01262 while (CookedReadData->BytesRead < CookedReadData->BufferSize) { 01263 01264 // 01265 // this call to GetChar may block. 01266 // 01267 01268 Status = GetChar(CookedReadData->InputInfo, 01269 &Char, 01270 TRUE, 01271 CookedReadData->Console, 01272 HandleData, 01273 WaitReplyMessage, 01274 CookedReadWaitRoutine, 01275 CookedReadData, 01276 sizeof(*CookedReadData), 01277 WaitRoutine, 01278 &CommandLineEditingKeys, 01279 NULL, 01280 &EnableScrollMode, 01281 &KeyState 01282 ); 01283 if (!NT_SUCCESS(Status)) { 01284 if (Status != CONSOLE_STATUS_WAIT) { 01285 CookedReadData->BytesRead = 0; 01286 } 01287 break; 01288 } 01289 01290 // 01291 // we should probably set these up in GetChars, but we set them 01292 // up here because the debugger is multi-threaded and calls 01293 // read before outputting the prompt. 01294 // 01295 01296 if (CookedReadData->OriginalCursorPosition.X == -1) { 01297 CookedReadData->OriginalCursorPosition = CookedReadData->ScreenInfo->BufferInfo.TextInfo.CursorPosition; 01298 } 01299 01300 if (CommandLineEditingKeys) { 01301 Status = ProcessCommandLine(CookedReadData,Char,KeyState,WaitReplyMessage,WaitingThread,WaitRoutine); 01302 if (Status == CONSOLE_STATUS_READ_COMPLETE || 01303 Status == CONSOLE_STATUS_WAIT) { 01304 break; 01305 } 01306 if (!NT_SUCCESS(Status)) { 01307 if (Status == CONSOLE_STATUS_WAIT_NO_BLOCK) { 01308 Status = CONSOLE_STATUS_WAIT; 01309 if (!WaitRoutine) { 01310 // 01311 // we have no wait block, so create one. 01312 // 01313 WaitForMoreToRead(CookedReadData->InputInfo, 01314 WaitReplyMessage, 01315 CookedReadWaitRoutine, 01316 CookedReadData, 01317 sizeof(*CookedReadData), 01318 FALSE 01319 ); 01320 } 01321 } else { 01322 CookedReadData->BytesRead = 0; 01323 } 01324 break; 01325 } 01326 } else { 01327 if (ProcessCookedReadInput(CookedReadData, 01328 Char, 01329 KeyState, 01330 &Status 01331 )) { 01332 CookedReadData->Console->Flags |= CONSOLE_IGNORE_NEXT_KEYUP; 01333 break; 01334 } 01335 } 01336 } 01337 01338 // 01339 // if the read was completed (status != wait), free the cooked read 01340 // data. also, close the temporary output handle that was opened to 01341 // echo the characters read. 01342 // 01343 01344 if (Status != CONSOLE_STATUS_WAIT) { 01345 01346 DWORD LineCount=1; 01347 if (CookedReadData->Echo) { 01348 BOOLEAN FoundCR; 01349 ULONG i,StringLength; 01350 PWCHAR StringPtr; 01351 01352 // figure out where real string ends (at carriage return 01353 // or end of buffer) 01354 01355 StringPtr = CookedReadData->BackupLimit; 01356 StringLength = CookedReadData->BytesRead; 01357 FoundCR = FALSE; 01358 for (i=0;i<(CookedReadData->BytesRead/sizeof(WCHAR));i++) { 01359 if (*StringPtr++ == UNICODE_CARRIAGERETURN) { 01360 StringLength = i*sizeof(WCHAR); 01361 FoundCR = TRUE; 01362 break; 01363 } 01364 } 01365 01366 if (FoundCR) { 01367 // 01368 // add to command line recall list 01369 // 01370 01371 AddCommand(CookedReadData->CommandHistory,CookedReadData->BackupLimit,(USHORT)StringLength,CookedReadData->Console->Flags & CONSOLE_HISTORY_NODUP); 01372 01373 // 01374 // check for alias 01375 // 01376 01377 i = CookedReadData->BufferSize; 01378 if (NT_SUCCESS(MatchandCopyAlias(CookedReadData->Console, 01379 CookedReadData->BackupLimit, 01380 (USHORT)StringLength, 01381 CookedReadData->BackupLimit, 01382 (PUSHORT)&i, 01383 CookedReadData->ExeName, 01384 CookedReadData->ExeNameLength, 01385 &LineCount 01386 ))) { 01387 CookedReadData->BytesRead = i; 01388 } 01389 } 01390 01391 CloseOutputHandle(CONSOLE_FROMTHREADPERPROCESSDATA(WaitingThread), 01392 CookedReadData->Console, 01393 &CookedReadData->TempHandle, 01394 NULL, 01395 FALSE 01396 ); 01397 } 01398 WaitReplyMessage->ReturnValue = Status; 01399 01400 // 01401 // at this point, a->NumBytes contains the number of bytes in 01402 // the UNICODE string read. UserBufferSize contains the converted 01403 // size of the app's buffer. 01404 // 01405 01406 if (CookedReadData->BytesRead > CookedReadData->UserBufferSize || LineCount > 1) { 01407 if (LineCount > 1) { 01408 PWSTR Tmp; 01409 HandleData->InputReadData->InputHandleFlags |= HANDLE_MULTI_LINE_INPUT; 01410 #ifdef FE_SB 01411 if (!a->Unicode && CONSOLE_IS_DBCS_CP(CookedReadData->Console)) { 01412 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 01413 fAddDbcsLead = TRUE; 01414 *CookedReadData->UserBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 01415 CookedReadData->UserBufferSize-=sizeof(WCHAR); 01416 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 01417 } 01418 NumBytes = 0; 01419 for (Tmp=CookedReadData->BackupLimit; 01420 *Tmp!=UNICODE_LINEFEED && CookedReadData->UserBufferSize/sizeof(WCHAR) > NumBytes; 01421 (IsConsoleFullWidth(CookedReadData->Console->hDC, 01422 CookedReadData->Console->CP,*Tmp) ? NumBytes+=2 : NumBytes++),Tmp++) ; 01423 } 01424 #endif 01425 for (Tmp=CookedReadData->BackupLimit;*Tmp!=UNICODE_LINEFEED;Tmp++) 01426 ASSERT(Tmp<(CookedReadData->BackupLimit+CookedReadData->BytesRead)); 01427 a->NumBytes = (ULONG)(Tmp-CookedReadData->BackupLimit+1)*sizeof(*Tmp); 01428 } else { 01429 #ifdef FE_SB 01430 if (!a->Unicode && CONSOLE_IS_DBCS_CP(CookedReadData->Console)) { 01431 PWSTR Tmp; 01432 01433 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 01434 fAddDbcsLead = TRUE; 01435 *CookedReadData->UserBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 01436 CookedReadData->UserBufferSize-=sizeof(WCHAR); 01437 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 01438 } 01439 NumBytes = 0; 01440 NumToWrite = CookedReadData->BytesRead; 01441 for (Tmp=CookedReadData->BackupLimit; 01442 NumToWrite && CookedReadData->UserBufferSize/sizeof(WCHAR) > NumBytes; 01443 (IsConsoleFullWidth(CookedReadData->Console->hDC, 01444 CookedReadData->Console->CP,*Tmp) ? NumBytes+=2 : NumBytes++),Tmp++,NumToWrite-=sizeof(WCHAR)) ; 01445 } 01446 #endif 01447 a->NumBytes = CookedReadData->UserBufferSize; 01448 } 01449 HandleData->InputReadData->InputHandleFlags |= HANDLE_INPUT_PENDING; 01450 HandleData->InputReadData->BufPtr = CookedReadData->BackupLimit; 01451 HandleData->InputReadData->BytesAvailable = CookedReadData->BytesRead - a->NumBytes; 01452 HandleData->InputReadData->CurrentBufPtr=(PWCHAR)((PBYTE)CookedReadData->BackupLimit+a->NumBytes); 01453 RtlCopyMemory(CookedReadData->UserBuffer,CookedReadData->BackupLimit,a->NumBytes); 01454 } 01455 else { 01456 #ifdef FE_SB 01457 if (!a->Unicode && CONSOLE_IS_DBCS_CP(CookedReadData->Console)) { 01458 PWSTR Tmp; 01459 01460 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 01461 fAddDbcsLead = TRUE; 01462 *CookedReadData->UserBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 01463 CookedReadData->UserBufferSize-=sizeof(WCHAR); 01464 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 01465 01466 if (CookedReadData->UserBufferSize == 0) { 01467 a->NumBytes = 1; 01468 ConsoleHeapFree(CookedReadData->BackupLimit); 01469 return STATUS_SUCCESS; 01470 } 01471 } 01472 NumBytes = 0; 01473 NumToWrite = CookedReadData->BytesRead; 01474 for (Tmp=CookedReadData->BackupLimit; 01475 NumToWrite && CookedReadData->UserBufferSize/sizeof(WCHAR) > NumBytes; 01476 (IsConsoleFullWidth(CookedReadData->Console->hDC, 01477 CookedReadData->Console->CP,*Tmp) ? NumBytes+=2 : NumBytes++),Tmp++,NumToWrite-=sizeof(WCHAR)) ; 01478 } 01479 #endif 01480 a->NumBytes = CookedReadData->BytesRead; 01481 RtlCopyMemory(CookedReadData->UserBuffer,CookedReadData->BackupLimit,a->NumBytes); 01482 ConsoleHeapFree(CookedReadData->BackupLimit); 01483 } 01484 a->ControlKeyState = CookedReadData->ControlKeyState; 01485 01486 if (!a->Unicode) { 01487 01488 // 01489 // if ansi, translate string. 01490 // 01491 01492 PCHAR TransBuffer; 01493 01494 #ifdef FE_SB 01495 if (CONSOLE_IS_DBCS_CP(CookedReadData->Console)) 01496 TransBuffer = (PCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_DBCS_TAG ),NumBytes); 01497 else 01498 #endif 01499 TransBuffer = (PCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),a->NumBytes / sizeof(WCHAR)); 01500 if (TransBuffer == NULL) { 01501 return STATUS_NO_MEMORY; 01502 } 01503 01504 #ifdef FE_SB 01505 if (CONSOLE_IS_DBCS_CP(CookedReadData->Console)) 01506 { 01507 a->NumBytes = TranslateUnicodeToOem(CookedReadData->Console, 01508 CookedReadData->UserBuffer, 01509 a->NumBytes / sizeof (WCHAR), 01510 TransBuffer, 01511 NumBytes, 01512 &HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte); 01513 } 01514 else 01515 #endif 01516 a->NumBytes = ConvertToOem(CookedReadData->Console->CP, 01517 CookedReadData->UserBuffer, 01518 a->NumBytes / sizeof (WCHAR), 01519 TransBuffer, 01520 a->NumBytes / sizeof (WCHAR) 01521 ); 01522 RtlCopyMemory(CookedReadData->UserBuffer,TransBuffer,a->NumBytes); 01523 #ifdef FE_SB 01524 if (fAddDbcsLead) 01525 a->NumBytes++; 01526 #endif 01527 ConsoleHeapFree(TransBuffer); 01528 } 01529 ConsoleHeapFree(CookedReadData->ExeName); 01530 if (WaitRoutine) { 01531 #ifdef FE_SB 01532 CookedReadData->Console->lpCookedReadData = NULL; 01533 #endif 01534 ConsoleHeapFree(CookedReadData); 01535 } 01536 } 01537 return Status; 01538 }

NTSTATUS CreateConsoleBitmap IN OUT PCONSOLE_GRAPHICS_BUFFER_INFO  GraphicsInfo,
IN OUT PSCREEN_INFORMATION  ScreenInfo,
OUT PVOID *  lpBitmap,
OUT HANDLE *  hMutex
 

Definition at line 27 of file w32/ntcon/server/bitmap.c.

References ASSERT, BMP_TAG, CONSOLE_CLIENTPROCESSHANDLE, ConsoleHeapAlloc, ConsoleHeapFree, DbgPrint, FALSE, L, MAKE_TAG, MapHandle(), NT_SUCCESS, NtClose(), NtCreateMutant(), NtCreateSection(), NtMapViewOfSection(), NTSTATUS(), NtUnmapViewOfSection(), NULL, SHORT, and Status.

Referenced by CreateScreenBuffer().

00033 { 00034 NTSTATUS Status; 00035 LARGE_INTEGER MaximumSize; 00036 SIZE_T ViewSize; 00037 00038 // 00039 // adjust bitmap info 00040 // 00041 00042 00043 if (GraphicsInfo->lpBitMapInfo->bmiHeader.biHeight > 0) 00044 { 00045 #if DBG 00046 DbgPrint("*************** Negating biHeight\n"); 00047 #endif 00048 GraphicsInfo->lpBitMapInfo->bmiHeader.biHeight = 00049 -GraphicsInfo->lpBitMapInfo->bmiHeader.biHeight; 00050 } 00051 00052 if (GraphicsInfo->lpBitMapInfo->bmiHeader.biCompression != BI_RGB) 00053 { 00054 #if DBG 00055 DbgPrint("*************** setting Compression to BI_RGB)\n"); 00056 #endif 00057 GraphicsInfo->lpBitMapInfo->bmiHeader.biCompression = BI_RGB; 00058 } 00059 00060 // 00061 // allocate screeninfo buffer data and copy it 00062 // 00063 00064 ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo = (LPBITMAPINFO)ConsoleHeapAlloc(MAKE_TAG( BMP_TAG ),GraphicsInfo->dwBitMapInfoLength); 00065 if (ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo == NULL) { 00066 return STATUS_NO_MEMORY; 00067 } 00068 ScreenInfo->BufferInfo.GraphicsInfo.BitMapInfoLength = GraphicsInfo->dwBitMapInfoLength; 00069 RtlCopyMemory(ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo, 00070 GraphicsInfo->lpBitMapInfo, 00071 GraphicsInfo->dwBitMapInfoLength 00072 ); 00073 ASSERT((GraphicsInfo->lpBitMapInfo->bmiHeader.biWidth * 00074 -GraphicsInfo->lpBitMapInfo->bmiHeader.biHeight / 8 * 00075 GraphicsInfo->lpBitMapInfo->bmiHeader.biBitCount) == 00076 (LONG)GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage); 00077 00078 // 00079 // create bitmap section 00080 // 00081 00082 MaximumSize.QuadPart = GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage; 00083 Status = NtCreateSection(&ScreenInfo->BufferInfo.GraphicsInfo.hSection, 00084 SECTION_ALL_ACCESS, 00085 NULL, 00086 &MaximumSize, 00087 PAGE_READWRITE, 00088 SEC_COMMIT, 00089 NULL 00090 ); 00091 if (!NT_SUCCESS(Status)) { 00092 ConsoleHeapFree(ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo); 00093 return Status; 00094 } 00095 00096 // 00097 // map server view of section 00098 // 00099 00100 ViewSize = GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage; 00101 ScreenInfo->BufferInfo.GraphicsInfo.BitMap = 0; 00102 Status = NtMapViewOfSection(ScreenInfo->BufferInfo.GraphicsInfo.hSection, 00103 NtCurrentProcess(), 00104 &ScreenInfo->BufferInfo.GraphicsInfo.BitMap, 00105 0L, 00106 GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage, 00107 NULL, 00108 &ViewSize, 00109 ViewUnmap, 00110 0L, 00111 PAGE_READWRITE 00112 ); 00113 if (!NT_SUCCESS(Status)) { 00114 ConsoleHeapFree(ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo); 00115 NtClose(ScreenInfo->BufferInfo.GraphicsInfo.hSection); 00116 return Status; 00117 } 00118 00119 // 00120 // map client view of section 00121 // 00122 00123 ViewSize = GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage; 00124 *lpBitmap = 0; 00125 Status = NtMapViewOfSection(ScreenInfo->BufferInfo.GraphicsInfo.hSection, 00126 CONSOLE_CLIENTPROCESSHANDLE(), 00127 lpBitmap, 00128 0L, 00129 GraphicsInfo->lpBitMapInfo->bmiHeader.biSizeImage, 00130 NULL, 00131 &ViewSize, 00132 ViewUnmap, 00133 0L, 00134 PAGE_READWRITE 00135 ); 00136 if (!NT_SUCCESS(Status)) { 00137 ConsoleHeapFree(ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo); 00138 NtUnmapViewOfSection(NtCurrentProcess(),ScreenInfo->BufferInfo.GraphicsInfo.BitMap); 00139 NtClose(ScreenInfo->BufferInfo.GraphicsInfo.hSection); 00140 return Status; 00141 } 00142 ScreenInfo->BufferInfo.GraphicsInfo.ClientProcess = CONSOLE_CLIENTPROCESSHANDLE(); 00143 ScreenInfo->BufferInfo.GraphicsInfo.ClientBitMap = *lpBitmap; 00144 00145 // 00146 // create mutex to serialize access to bitmap, then map handle to mutex to client side 00147 // 00148 00149 NtCreateMutant(&ScreenInfo->BufferInfo.GraphicsInfo.hMutex, 00150 MUTANT_ALL_ACCESS, NULL, FALSE); 00151 MapHandle(CONSOLE_CLIENTPROCESSHANDLE(), 00152 ScreenInfo->BufferInfo.GraphicsInfo.hMutex, 00153 hMutex 00154 ); 00155 00156 ScreenInfo->BufferInfo.GraphicsInfo.dwUsage = GraphicsInfo->dwUsage; 00157 ScreenInfo->ScreenBufferSize.X = (WORD)GraphicsInfo->lpBitMapInfo->bmiHeader.biWidth; 00158 ScreenInfo->ScreenBufferSize.Y = (WORD)-GraphicsInfo->lpBitMapInfo->bmiHeader.biHeight; 00159 ScreenInfo->Window.Left = 0; 00160 ScreenInfo->Window.Top = 0; 00161 ScreenInfo->Window.Right = (SHORT)(ScreenInfo->Window.Left+ScreenInfo->ScreenBufferSize.X-1); 00162 ScreenInfo->Window.Bottom = (SHORT)(ScreenInfo->Window.Top+ScreenInfo->ScreenBufferSize.Y-1); 00163 return STATUS_SUCCESS; 00164 }

int CreateCtrlThread IN PCONSOLE_PROCESS_TERMINATION_RECORD  ProcessHandleList,
IN ULONG  ProcessHandleListLength,
IN PWCHAR  Title,
IN DWORD  EventType,
IN BOOL  fForce
 

Definition at line 3502 of file ntcon/server/input.c.

References Action, BHE_ACTIVATE, BHE_FORCE, BOOL, BoostHardError(), CONSOLE_SHUTDOWN_FAILED, CONSOLE_SHUTDOWN_SUCCEEDED, CONSOLE_SHUTDOWN_SYSTEM, CtrlRoutine, DebugPort, DialogBoxCount, DWORD, FALSE, gCmsHungAppTimeout, gCmsWaitToKillTimeout, gdwServicesProcessId, gdwServicesWaitToKillTimeout, InternalCreateCallbackThread(), InternalWaitCancel(), KillProcess(), NT_SUCCESS, NtQueryInformationProcess(), NTSTATUS(), NULL, Status, ThreadShutdownNotify(), TRUE, TSN_USERSAYSCANCEL, and WMCS_CONSOLE.

Referenced by NonConsoleProcessShutdown(), ProcessCtrlEvents(), and RemoveConsole().

03513 { 03514 HANDLE Thread; 03515 DWORD Status; 03516 NTSTATUS status; 03517 DWORD ShutdownFlags; 03518 int Success=CONSOLE_SHUTDOWN_SUCCEEDED; 03519 ULONG i; 03520 DWORD EventFlags; 03521 PROCESS_BASIC_INFORMATION BasicInfo; 03522 PCSR_PROCESS Process; 03523 BOOL fForceProcess; 03524 BOOL fExitProcess; 03525 BOOL fFirstPass=TRUE; 03526 BOOL fSecondPassNeeded=FALSE; 03527 BOOL fHasError; 03528 BOOL fFirstWait; 03529 BOOL fEventProcessed; 03530 BOOL fBreakEvent; 03531 03532 BigLoop: 03533 for (i=0;i<ProcessHandleListLength;i++) { 03534 03535 // 03536 // If the user has already cancelled shutdown, don't try to kill 03537 // any more processes. 03538 // 03539 03540 if (Success == CONSOLE_SHUTDOWN_FAILED) { 03541 break; 03542 } 03543 03544 // 03545 // Get the process shutdown parameters here. First get the process 03546 // id so we can get the csr process structure pointer. 03547 // 03548 03549 status = NtQueryInformationProcess( 03550 ProcessHandleList[i].ProcessHandle, 03551 ProcessBasicInformation, 03552 &BasicInfo, 03553 sizeof(BasicInfo), 03554 NULL); 03555 03556 // 03557 // Grab the shutdown flags from the csr process structure. If 03558 // the structure cannot be found, terminate the process. 03559 // 03560 03561 ProcessHandleList[i].bDebugee = FALSE; 03562 ShutdownFlags = 0; 03563 if (NT_SUCCESS(status)) { 03564 CsrLockProcessByClientId( 03565 (HANDLE)BasicInfo.UniqueProcessId, &Process); 03566 if (Process == NULL) { 03567 KillProcess(&ProcessHandleList[i], 03568 BasicInfo.UniqueProcessId); 03569 continue; 03570 } 03571 } else { 03572 KillProcess(&ProcessHandleList[i], 0); 03573 continue; 03574 } 03575 ShutdownFlags = Process->ShutdownFlags; 03576 ProcessHandleList[i].bDebugee = Process->DebugUserInterface.UniqueProcess!=NULL; 03577 CsrUnlockProcess(Process); 03578 03579 if (!ProcessHandleList[i].bDebugee) { 03580 HANDLE DebugPort; 03581 03582 // see if we're a OS/2 app that's being debugged 03583 DebugPort = (HANDLE)NULL; 03584 status = NtQueryInformationProcess( 03585 ProcessHandleList[i].ProcessHandle, 03586 ProcessDebugPort, 03587 (PVOID)&DebugPort, 03588 sizeof(DebugPort), 03589 NULL 03590 ); 03591 if ( NT_SUCCESS(status) && DebugPort ) { 03592 ProcessHandleList[i].bDebugee = TRUE; 03593 } 03594 } 03595 if (EventType != CTRL_C_EVENT && EventType != CTRL_BREAK_EVENT) { 03596 fBreakEvent = FALSE; 03597 if (fFirstPass) { 03598 if (ProcessHandleList[i].bDebugee) { 03599 fSecondPassNeeded = TRUE; 03600 continue; 03601 } 03602 } else { 03603 if (!ProcessHandleList[i].bDebugee) { 03604 continue; 03605 } 03606 } 03607 } else { 03608 fBreakEvent = TRUE; 03609 fFirstPass=FALSE; 03610 } 03611 03612 // 03613 // fForce is whether ExitWindowsEx was called with EWX_FORCE. 03614 // ShutdownFlags are the shutdown flags for this process. If 03615 // either are force (noretry is the same as force), then force: 03616 // which means if the app doesn't exit, don't bring up the retry 03617 // dialog - just force it to exit right away. 03618 // 03619 03620 fForceProcess = fForce || (ShutdownFlags & SHUTDOWN_NORETRY); 03621 03622 // 03623 // Only notify system security and service context processes. 03624 // Don't bring up retry dialogs for them. 03625 // 03626 03627 fExitProcess = TRUE; 03628 EventFlags = 0; 03629 if (ShutdownFlags & (SHUTDOWN_SYSTEMCONTEXT | SHUTDOWN_OTHERCONTEXT)) { 03630 03631 // 03632 // System context - make sure we don't cause it to exit, make 03633 // sure we don't bring up retry dialogs. 03634 // 03635 03636 fExitProcess = FALSE; 03637 fForceProcess = TRUE; 03638 03639 // 03640 // This EventFlag will be passed on down to the CtrlRoutine() 03641 // on the client side. That way that side knows not to exit 03642 // this process. 03643 // 03644 03645 EventFlags = 0x80000000; 03646 } 03647 03648 // 03649 // Is this the first time we're waiting for this process to die? 03650 // 03651 03652 fFirstWait = TRUE; 03653 fEventProcessed = FALSE; 03654 03655 while (!fEventProcessed) { 03656 DWORD ThreadExitCode; 03657 DWORD ProcessExitCode; 03658 DWORD cMsTimeout; 03659 03660 Thread = InternalCreateCallbackThread( 03661 ProcessHandleList[i].ProcessHandle, 03662 (ULONG_PTR)ProcessHandleList[i].CtrlRoutine, 03663 EventType | EventFlags); 03664 03665 // 03666 // If the thread cannot be created, terminate the process. 03667 // 03668 03669 if (Thread == NULL) { 03670 KdPrint(("CONSRV: CreateRemoteThread failed %x\n",GetLastError())); 03671 break; 03672 } 03673 03674 // 03675 // Mark the event as processed. 03676 // 03677 03678 fEventProcessed = TRUE; 03679 03680 /* 03681 * if it's a ctrl-c or ctrl-break event, just close our 03682 * handle to the thread. otherwise it's a close. wait 03683 * for client-side thread to terminate. 03684 */ 03685 03686 if (EventType == CTRL_CLOSE_EVENT) { 03687 cMsTimeout = gCmsHungAppTimeout; 03688 } else if (EventType == CTRL_LOGOFF_EVENT) { 03689 cMsTimeout = gCmsWaitToKillTimeout; 03690 } else if (EventType == CTRL_SHUTDOWN_EVENT) { 03691 03692 // 03693 // If we are shutting down services.exe, we need to look in the 03694 // registry to see how long to wait. 03695 // 03696 03697 if (fFirstWait && BasicInfo.UniqueProcessId == gdwServicesProcessId) { 03698 cMsTimeout = gdwServicesWaitToKillTimeout; 03699 } else { 03700 cMsTimeout = gCmsWaitToKillTimeout; 03701 } 03702 } else { 03703 CloseHandle(Thread); 03704 fExitProcess = FALSE; 03705 break; 03706 } 03707 03708 while (TRUE) { 03709 fHasError = BoostHardError(BasicInfo.UniqueProcessId, 03710 (fForceProcess ? BHE_FORCE : BHE_ACTIVATE)); 03711 03712 // 03713 // Use a 1 second wait if there was a hard error, otherwise 03714 // wait cMsTimeout ms. 03715 // 03716 03717 Status = InternalWaitCancel(Thread, 03718 (fHasError && fForceProcess) ? 1000 : cMsTimeout); 03719 if (Status == WAIT_TIMEOUT) { 03720 int Action; 03721 03722 // 03723 // If there was a hard error, see if there is another one. 03724 // 03725 03726 if (fHasError && fForceProcess) { 03727 continue; 03728 } 03729 03730 if (!fForceProcess) { 03731 03732 // 03733 // we timed out in the handler. ask the user what 03734 // to do. 03735 // 03736 03737 DialogBoxCount++; 03738 Action = ThreadShutdownNotify(WMCS_CONSOLE, (ULONG_PTR)Thread, (LPARAM)Title); 03739 DialogBoxCount--; 03740 03741 // 03742 // If the response is Cancel or EndTask, exit the loop. 03743 // Otherwise retry the wait. 03744 // 03745 03746 if (Action == TSN_USERSAYSCANCEL) { 03747 Success = CONSOLE_SHUTDOWN_FAILED; 03748 } 03749 } 03750 } else if (Status == 0) { 03751 ThreadExitCode = 0; 03752 GetExitCodeThread(Thread,&ThreadExitCode); 03753 GetExitCodeProcess(ProcessHandleList[i].ProcessHandle, 03754 &ProcessExitCode); 03755 03756 // 03757 // if the app returned TRUE (event handled) 03758 // notify the user and see if the app should 03759 // be terminated anyway. 03760 // 03761 03762 if (fHasError || (ThreadExitCode == EventType && 03763 ProcessExitCode == STILL_ACTIVE)) { 03764 int Action; 03765 03766 if (!fForceProcess) { 03767 03768 // 03769 // Wait for the process to exit. If it does exit, 03770 // don't bring up the end task dialog. 03771 // 03772 03773 Status = InternalWaitCancel(ProcessHandleList[i].ProcessHandle, 03774 (fHasError || fFirstWait) ? 1000 : cMsTimeout); 03775 if (Status == 0) { 03776 03777 // 03778 // The process exited. 03779 // 03780 03781 fExitProcess = FALSE; 03782 } else if (Status == WAIT_TIMEOUT) { 03783 DialogBoxCount++; 03784 Action = ThreadShutdownNotify(WMCS_CONSOLE, 03785 (ULONG_PTR)ProcessHandleList[i].ProcessHandle, 03786 (LPARAM)Title); 03787 DialogBoxCount--; 03788 03789 if (Action == TSN_USERSAYSCANCEL) { 03790 Success = CONSOLE_SHUTDOWN_FAILED; 03791 } 03792 } 03793 } 03794 } else { 03795 03796 // 03797 // The process exited. 03798 // 03799 03800 fExitProcess = FALSE; 03801 } 03802 } 03803 03804 // 03805 // If we get here, we know that all wait conditions have 03806 // been satisfied. Time to finish with the process. 03807 // 03808 03809 break; 03810 } 03811 03812 CloseHandle(Thread); 03813 } 03814 03815 // 03816 // If the process is shutting down, mark it as terminated. 03817 // This prevents the process from raising any hard error popups 03818 // after we're done shutting it down. 03819 // 03820 03821 if (!fBreakEvent && 03822 !(ShutdownFlags & (SHUTDOWN_SYSTEMCONTEXT | SHUTDOWN_OTHERCONTEXT)) && 03823 Success == CONSOLE_SHUTDOWN_SUCCEEDED) { 03824 CsrLockProcessByClientId( 03825 (HANDLE)BasicInfo.UniqueProcessId, &Process); 03826 if (Process) { 03827 Process->Flags |= CSR_PROCESS_TERMINATED; 03828 CsrUnlockProcess(Process); 03829 } 03830 03831 // 03832 // Force the termination of the process if needed. Otherwise, 03833 // acknowledge any remaining hard errors. 03834 // 03835 if (fExitProcess) { 03836 KillProcess(&ProcessHandleList[i], 03837 BasicInfo.UniqueProcessId); 03838 } else { 03839 BoostHardError(BasicInfo.UniqueProcessId, BHE_FORCE); 03840 } 03841 } 03842 } 03843 03844 // 03845 // If this was our first time through and we skipped one of the 03846 // processes because it was being debugged, we'll go back for a 03847 // second pass. 03848 // 03849 03850 if (fFirstPass && fSecondPassNeeded) { 03851 fFirstPass = FALSE; 03852 goto BigLoop; 03853 } 03854 03855 // if we're shutting down a system or service security context 03856 // thread, don't wait for the process to terminate 03857 03858 if (ShutdownFlags & (SHUTDOWN_SYSTEMCONTEXT | SHUTDOWN_OTHERCONTEXT)) { 03859 return CONSOLE_SHUTDOWN_SYSTEM; 03860 } 03861 return Success; 03862 }

NTSTATUS CreateInputBuffer IN ULONG NumberOfEvents  OPTIONAL,
IN PINPUT_INFORMATION  InputBufferInformation
 

Definition at line 103 of file ntcon/server/input.c.

References BUFFER_TAG, BufferSize, ConsoleHeapAlloc, ConsoleHeapFree, DEFAULT_NUMBER_OF_EVENTS, FALSE, MAKE_TAG, NT_SUCCESS, NtCreateEvent(), NTSTATUS(), NULL, and Status.

Referenced by AllocateConsole().

00114 : 00115 00116 This routine creates an input buffer. It allocates the circular 00117 buffer and initializes the information fields. 00118 00119 Arguments: 00120 00121 NumberOfEvents - Size of input buffer in events. 00122 00123 InputBufferInformation - Pointer to input buffer information structure. 00124 00125 Return Value: 00126 00127 00128 --*/ 00129 00130 { 00131 ULONG BufferSize; 00132 NTSTATUS Status; 00133 00134 if (NumberOfEvents == 0) { 00135 NumberOfEvents = DEFAULT_NUMBER_OF_EVENTS; 00136 } 00137 00138 // allocate memory for circular buffer 00139 00140 BufferSize = sizeof(INPUT_RECORD) * (NumberOfEvents+1); 00141 InputBufferInformation->InputBuffer = (PINPUT_RECORD)ConsoleHeapAlloc(MAKE_TAG( BUFFER_TAG ),BufferSize); 00142 if (InputBufferInformation->InputBuffer == NULL) { 00143 return STATUS_NO_MEMORY; 00144 } 00145 Status = NtCreateEvent(&InputBufferInformation->InputWaitEvent, 00146 EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE); 00147 if (!NT_SUCCESS(Status)) { 00148 ConsoleHeapFree(InputBufferInformation->InputBuffer); 00149 return STATUS_NO_MEMORY; 00150 } 00151 InitializeListHead(&InputBufferInformation->ReadWaitQueue); 00152 00153 // initialize buffer header 00154 00155 InputBufferInformation->InputBufferSize = NumberOfEvents; 00156 InputBufferInformation->ShareAccess.OpenCount = 0; 00157 InputBufferInformation->ShareAccess.Readers = 0; 00158 InputBufferInformation->ShareAccess.Writers = 0; 00159 InputBufferInformation->ShareAccess.SharedRead = 0; 00160 InputBufferInformation->ShareAccess.SharedWrite = 0; 00161 InputBufferInformation->InputMode = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT; 00162 InputBufferInformation->AllocatedBufferSize = BufferSize; 00163 InputBufferInformation->RefCount = 0; 00164 InputBufferInformation->First = (ULONG_PTR) InputBufferInformation->InputBuffer; 00165 InputBufferInformation->In = (ULONG_PTR) InputBufferInformation->InputBuffer; 00166 InputBufferInformation->Out = (ULONG_PTR) InputBufferInformation->InputBuffer; 00167 InputBufferInformation->Last = (ULONG_PTR) InputBufferInformation->InputBuffer + BufferSize; 00168 #if defined(FE_SB) 00169 #if defined(FE_IME) 00170 InputBufferInformation->ImeMode.Disable = FALSE; 00171 InputBufferInformation->ImeMode.Unavailable = FALSE; 00172 InputBufferInformation->ImeMode.Open = FALSE; 00173 InputBufferInformation->ImeMode.ReadyConversion = FALSE; 00174 #endif // FE_IME 00175 InputBufferInformation->Console = Console; 00176 RtlZeroMemory(&InputBufferInformation->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 00177 RtlZeroMemory(&InputBufferInformation->WriteConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 00178 #endif 00179 00180 return STATUS_SUCCESS; 00181 }

NTSTATUS CreateScreenBuffer OUT PSCREEN_INFORMATION ScreenInformation,
IN COORD dwWindowSize  OPTIONAL,
IN DWORD nFont  OPTIONAL,
IN COORD dwScreenBufferSize  OPTIONAL,
IN CHAR_INFO  Fill,
IN CHAR_INFO  PopupFill,
IN PCONSOLE_INFORMATION  Console,
IN DWORD  Flags,
IN PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo  OPTIONAL,
OUT PVOID *  lpBitmap,
OUT HANDLE *  hMutex,
IN UINT  CursorSize,
IN LPWSTR  FaceName
 

NTSTATUS CreateWindowsWindow IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 834 of file output.c.

References ASSERT, _SCREEN_INFORMATION::Attributes, ChangeDispSettings(), CONSOLE_IS_ICONIC, CONSOLE_IS_IME_ENABLED, CONSOLE_NO_WINDOW, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_CLASS, CONSOLE_WINDOW_EX_FLAGS, CONSOLE_WINDOW_FLAGS, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, ConsoleSetActiveWindow(), ConvertToFullScreen(), CreateWindowEx(), DbgPrint, DestroyWindow, DWORD, FALSE, _SCREEN_INFORMATION::Flags, GetDC, ghDefaultIcon, ghDefaultSmIcon, ghInstance, gnConsoleWindows, guCaretBlinkTime, HorizontalClientToWindow, HorizontalScrollSize, hWnd, INITIALIZATION_FAILED, INITIALIZATION_SUCCEEDED, InitSystemMenu(), InternalUpdateScrollBars(), L, NT_SUCCESS, NtQueryInformationThread(), NtSetEvent(), NULL, _SCREEN_INFORMATION::PopupAttributes, PositionConsoleWindow(), PostMessage(), ProgmanHandleMessage, RegisterKeisenOfTTFont(), SCR_FONTSIZE(), SendMessage(), SetConsolePid, SetConsoleTid, SetFont(), SetScreenColors(), SetTimer, SetWindowConsole, TRUE, VerticalClientToWindow, VerticalScrollSize, _SCREEN_INFORMATION::WindowMaximizedX, and _SCREEN_INFORMATION::WindowMaximizedY.

Referenced by ProcessCreateConsoleWindow().

00837 { 00838 PSCREEN_INFORMATION ScreenInfo; 00839 SIZE WindowSize; 00840 DWORD Style; 00841 THREAD_BASIC_INFORMATION ThreadInfo; 00842 HWND hWnd; 00843 00844 ScreenInfo = Console->ScreenBuffers; 00845 00846 // 00847 // figure out how big to make the window, given the desired client area 00848 // size. window is always created in textmode. 00849 // 00850 00851 ASSERT(ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER); 00852 WindowSize.cx = CONSOLE_WINDOW_SIZE_X(ScreenInfo)*SCR_FONTSIZE(ScreenInfo).X + VerticalClientToWindow; 00853 WindowSize.cy = CONSOLE_WINDOW_SIZE_Y(ScreenInfo)*SCR_FONTSIZE(ScreenInfo).Y + HorizontalClientToWindow; 00854 Style = CONSOLE_WINDOW_FLAGS & ~WS_VISIBLE; 00855 if (!ScreenInfo->WindowMaximizedX) { 00856 WindowSize.cy += HorizontalScrollSize; 00857 } else { 00858 Style &= ~WS_HSCROLL; 00859 } 00860 if (!ScreenInfo->WindowMaximizedY) { 00861 WindowSize.cx += VerticalScrollSize; 00862 } else { 00863 Style &= ~WS_VSCROLL; 00864 } 00865 #ifdef THERESES_DEBUG 00866 DbgPrint("creating window with char size %d %d\n",CONSOLE_WINDOW_SIZE_X(ScreenInfo),CONSOLE_WINDOW_SIZE_Y(ScreenInfo)); 00867 DbgPrint(" pixel size %d %d\n",WindowSize.cx,WindowSize.cy); 00868 #endif 00869 00870 // 00871 // create the window. 00872 // 00873 00874 Console->WindowRect.left = Console->dwWindowOriginX; 00875 Console->WindowRect.top = Console->dwWindowOriginY; 00876 Console->WindowRect.right = WindowSize.cx + Console->dwWindowOriginX; 00877 Console->WindowRect.bottom = WindowSize.cy + Console->dwWindowOriginY; 00878 hWnd = CreateWindowEx(CONSOLE_WINDOW_EX_FLAGS, 00879 CONSOLE_WINDOW_CLASS, 00880 Console->Title, 00881 Style, 00882 Console->dwWindowOriginX, 00883 Console->dwWindowOriginY, 00884 WindowSize.cx, 00885 WindowSize.cy, 00886 (Console->Flags & CONSOLE_NO_WINDOW) ? HWND_MESSAGE : HWND_DESKTOP, 00887 NULL, 00888 ghInstance, 00889 NULL); 00890 if (hWnd == NULL) { 00891 NtSetEvent(Console->InitEvents[INITIALIZATION_FAILED],NULL); 00892 return STATUS_NO_MEMORY; 00893 } 00894 Console->hWnd = hWnd; 00895 00896 SetWindowConsole(hWnd, Console); 00897 00898 // 00899 // Stuff the client id into the window so USER can find it. 00900 // 00901 00902 if (NT_SUCCESS(NtQueryInformationThread(Console->ClientThreadHandle, 00903 ThreadBasicInformation, &ThreadInfo, 00904 sizeof(ThreadInfo), NULL))) { 00905 00906 SetConsolePid(Console->hWnd, HandleToUlong(ThreadInfo.ClientId.UniqueProcess)); 00907 SetConsoleTid(Console->hWnd, HandleToUlong(ThreadInfo.ClientId.UniqueThread)); 00908 } 00909 00910 // 00911 // Get the dc. 00912 // 00913 00914 Console->hDC = GetDC(Console->hWnd); 00915 00916 if (Console->hDC == NULL) { 00917 NtSetEvent(Console->InitEvents[INITIALIZATION_FAILED],NULL); 00918 DestroyWindow(Console->hWnd); 00919 Console->hWnd = NULL; 00920 return STATUS_NO_MEMORY; 00921 } 00922 Console->hMenu = GetSystemMenu(Console->hWnd,FALSE); 00923 00924 // 00925 // modify system menu to our liking. 00926 // 00927 00928 InitSystemMenu(Console); 00929 00930 gnConsoleWindows++; 00931 Console->InputThreadInfo->WindowCount++; 00932 00933 #if defined(FE_IME) 00934 SetUndetermineAttribute(Console); 00935 #endif 00936 #if defined(FE_SB) 00937 RegisterKeisenOfTTFont(ScreenInfo); 00938 #endif 00939 00940 // 00941 // Set up the hot key for this window 00942 // 00943 if ((Console->dwHotKey != 0) && !(Console->Flags & CONSOLE_NO_WINDOW)) { 00944 SendMessage(Console->hWnd, WM_SETHOTKEY, Console->dwHotKey, 0L); 00945 } 00946 00947 // 00948 // create icon 00949 // 00950 00951 if (Console->iIconId) { 00952 00953 // We have no icon, try and get one from progman. 00954 00955 PostMessage(HWND_BROADCAST, 00956 ProgmanHandleMessage, 00957 (WPARAM)Console->hWnd, 00958 1); 00959 } 00960 if (Console->hIcon == NULL) { 00961 Console->hIcon = ghDefaultIcon; 00962 Console->hSmIcon = ghDefaultSmIcon; 00963 } else if (Console->hIcon != ghDefaultIcon) { 00964 SendMessage(Console->hWnd, WM_SETICON, ICON_BIG, (LPARAM)Console->hIcon); 00965 SendMessage(Console->hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Console->hSmIcon); 00966 } 00967 00968 SetBkMode(Console->hDC,OPAQUE); 00969 SetFont(ScreenInfo); 00970 SelectObject(Console->hDC, GetStockObject(DC_BRUSH)); 00971 SetScreenColors(ScreenInfo, ScreenInfo->Attributes, 00972 ScreenInfo->PopupAttributes, FALSE); 00973 if (Console->Flags & CONSOLE_NO_WINDOW) { 00974 ShowWindowAsync(Console->hWnd, SW_HIDE); 00975 #ifdef i386 00976 } else if (Console->FullScreenFlags != 0) { 00977 if (Console->wShowWindow == SW_SHOWMINNOACTIVE) { 00978 ShowWindowAsync(Console->hWnd, Console->wShowWindow); 00979 Console->FullScreenFlags = 0; 00980 Console->Flags |= CONSOLE_IS_ICONIC; 00981 } else { 00982 ConvertToFullScreen(Console); 00983 if (!NT_SUCCESS(ConsoleSetActiveWindow(Console))) { 00984 return STATUS_INVALID_HANDLE; 00985 } 00986 00987 ChangeDispSettings(Console, Console->hWnd,CDS_FULLSCREEN); 00988 } 00989 #endif 00990 } else { 00991 if (Console->wShowWindow != SW_SHOWNOACTIVATE && 00992 Console->wShowWindow != SW_SHOWMINNOACTIVE && 00993 Console->wShowWindow != SW_HIDE) { 00994 if (!NT_SUCCESS(ConsoleSetActiveWindow(Console))) { 00995 return STATUS_INVALID_HANDLE; 00996 } 00997 } else if (Console->wShowWindow == SW_SHOWMINNOACTIVE) { 00998 Console->Flags |= CONSOLE_IS_ICONIC; 00999 } 01000 ShowWindowAsync(Console->hWnd, Console->wShowWindow); 01001 } 01002 01003 //UpdateWindow(Console->hWnd); 01004 InternalUpdateScrollBars(ScreenInfo); 01005 if (!(Console->Flags & CONSOLE_IS_ICONIC) && 01006 (Console->FullScreenFlags == 0) ) { 01007 01008 PositionConsoleWindow(Console, TRUE); 01009 } 01010 01011 #if defined(FE_IME) 01012 if (CONSOLE_IS_IME_ENABLED() && !(Console->Flags & CONSOLE_NO_WINDOW)) { 01013 SetTimer(Console->hWnd, SCROLL_WAIT_TIMER, guCaretBlinkTime, NULL); 01014 } 01015 #endif 01016 NtSetEvent(Console->InitEvents[INITIALIZATION_SUCCEEDED],NULL); 01017 return STATUS_SUCCESS; 01018 }

VOID CursorTimerRoutine IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 332 of file ntcon/server/cursor.c.

References CONSOLE_HAS_FOCUS, CONSOLE_TEXTMODE_BUFFER, FALSE, InvertPixels(), NtUserConsoleControl(), and SCR_FONTSIZE().

Referenced by ConsoleWindowProc(), and SetCursorPosition().

00338 : 00339 00340 This routine is called when the timer in the console with the focus 00341 goes off. It blinks the cursor. 00342 00343 Arguments: 00344 00345 ScreenInfo - pointer to screen info structure. 00346 00347 Return Value: 00348 00349 none. 00350 00351 --*/ 00352 00353 { 00354 if (!(ScreenInfo->Console->Flags & CONSOLE_HAS_FOCUS)) 00355 return; 00356 00357 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00358 00359 // 00360 // Update the cursor pos in USER so accessibility will work 00361 // 00362 00363 if (ScreenInfo->BufferInfo.TextInfo.CursorMoved) { 00364 00365 CONSOLE_CARET_INFO ConsoleCaretInfo; 00366 00367 ScreenInfo->BufferInfo.TextInfo.CursorMoved = FALSE; 00368 ConsoleCaretInfo.hwnd = ScreenInfo->Console->hWnd; 00369 ConsoleCaretInfo.rc.left = (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X - ScreenInfo->Window.Left) * SCR_FONTSIZE(ScreenInfo).X; 00370 ConsoleCaretInfo.rc.top = (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y - ScreenInfo->Window.Top) * SCR_FONTSIZE(ScreenInfo).Y; 00371 ConsoleCaretInfo.rc.right = ConsoleCaretInfo.rc.left + SCR_FONTSIZE(ScreenInfo).X; 00372 ConsoleCaretInfo.rc.bottom = ConsoleCaretInfo.rc.top + SCR_FONTSIZE(ScreenInfo).Y; 00373 NtUserConsoleControl(ConsoleSetCaretInfo, 00374 &ConsoleCaretInfo, 00375 sizeof(ConsoleCaretInfo)); 00376 } 00377 00378 // if the DelayCursor flag has been set, wait one more tick before toggle. 00379 // This is used to guarantee the cursor is on for a finite period of time 00380 // after a move and off for a finite period of time after a WriteString 00381 00382 if (ScreenInfo->BufferInfo.TextInfo.DelayCursor) { 00383 ScreenInfo->BufferInfo.TextInfo.DelayCursor = FALSE; 00384 return; 00385 } 00386 00387 // don't blink the cursor for remote sessions 00388 if (NtCurrentPeb()->SessionId > 0 && 00389 ScreenInfo->BufferInfo.TextInfo.CursorOn) { 00390 00391 return; 00392 } 00393 00394 if (ScreenInfo->BufferInfo.TextInfo.CursorVisible && 00395 !ScreenInfo->BufferInfo.TextInfo.UpdatingScreen) { 00396 InvertPixels(ScreenInfo); 00397 ScreenInfo->BufferInfo.TextInfo.CursorOn = !ScreenInfo->BufferInfo.TextInfo.CursorOn; 00398 } 00399 } 00400 }

NTSTATUS DereferenceConsoleHandle IN HANDLE  ConsoleHandle,
OUT PCONSOLE_INFORMATION Console
 

Definition at line 175 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_TERMINATING, ConsoleHandles, ConsoleHandleTableLocked, IndexFromHandle, NULL, and NumberOfConsoleHandles.

Referenced by RevalidateConsole(), SetUpConsole(), and WriteConsoleWaitRoutine().

00182 : 00183 00184 This routine converts a console handle value into a pointer to the 00185 console data structure. 00186 00187 Arguments: 00188 00189 ConsoleHandle - console handle to convert. 00190 00191 Console - On output, contains pointer to the console data structure. 00192 00193 Return Value: 00194 00195 none. 00196 00197 Note: 00198 00199 The console handle table lock must be held when calling this routine. 00200 00201 --*/ 00202 00203 { 00204 ULONG i; 00205 00206 ASSERT(ConsoleHandleTableLocked()); 00207 00208 i = IndexFromHandle(ConsoleHandle); 00209 if ((i >= NumberOfConsoleHandles) || 00210 ((*Console = ConsoleHandles[i]) == NULL) || 00211 ((*Console)->ConsoleHandle != ConsoleHandle)) { 00212 *Console = NULL; 00213 return STATUS_INVALID_HANDLE; 00214 } 00215 if ((*Console)->Flags & CONSOLE_TERMINATING) { 00216 *Console = NULL; 00217 return STATUS_PROCESS_IS_TERMINATING; 00218 } 00219 return STATUS_SUCCESS; 00220 }

NTSTATUS DereferenceIoHandle IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN HANDLE  Handle,
IN ULONG  HandleType,
IN ACCESS_MASK  Access,
OUT PHANDLE_DATA HandleData
 

Definition at line 1536 of file w32/ntcon/server/handle.c.

References CONSOLE_FREE_HANDLE, CONSOLE_HANDLE, Handle, HANDLE_TO_INDEX, and Index.

Referenced by SrvConsoleMenuControl(), SrvFillConsoleOutput(), SrvFlushConsoleInputBuffer(), SrvGetConsoleCurrentFont(), SrvGetConsoleCursorInfo(), SrvGetConsoleFontInfo(), SrvGetConsoleFontSize(), SrvGetConsoleHardwareState(), SrvGetConsoleInput(), SrvGetConsoleMode(), SrvGetConsoleNumberOfInputEvents(), SrvGetConsoleScreenBufferInfo(), SrvGetLargestConsoleWindowSize(), SrvInvalidateBitMapRect(), SrvReadConsole(), SrvReadConsoleOutput(), SrvReadConsoleOutputString(), SrvScrollConsoleScreenBuffer(), SrvSetConsoleActiveScreenBuffer(), SrvSetConsoleCursor(), SrvSetConsoleCursorInfo(), SrvSetConsoleCursorPosition(), SrvSetConsoleDisplayMode(), SrvSetConsoleFont(), SrvSetConsoleHardwareState(), SrvSetConsoleMode(), SrvSetConsolePalette(), SrvSetConsoleScreenBufferSize(), SrvSetConsoleTextAttribute(), SrvSetConsoleWindowInfo(), SrvShowConsoleCursor(), SrvWriteConsole(), SrvWriteConsoleInput(), SrvWriteConsoleOutput(), SrvWriteConsoleOutputString(), and WWSB_DoWriteConsole().

01546 : 01547 01548 This routine verifies a handle's validity, then returns a pointer to 01549 the handle data structure. 01550 01551 Arguments: 01552 01553 ProcessData - Pointer to per process data structure. 01554 01555 Handle - Handle to dereference. 01556 01557 HandleData - On return, pointer to handle data structure. 01558 01559 Return Value: 01560 01561 --*/ 01562 01563 { 01564 ULONG_PTR Index; 01565 01566 if (!CONSOLE_HANDLE(Handle)) { 01567 return STATUS_INVALID_HANDLE; 01568 } 01569 Index = (ULONG_PTR)HANDLE_TO_INDEX(Handle); 01570 if ((Index >= ProcessData->HandleTableSize) || 01571 (ProcessData->HandleTablePtr[Index].HandleType == CONSOLE_FREE_HANDLE) || 01572 !(ProcessData->HandleTablePtr[Index].HandleType & HandleType) || 01573 !(ProcessData->HandleTablePtr[Index].Access & Access) ) { 01574 return STATUS_INVALID_HANDLE; 01575 } 01576 *HandleData = &ProcessData->HandleTablePtr[Index]; 01577 return STATUS_SUCCESS; 01578 }

NTSTATUS DereferenceIoHandleNoCheck IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN HANDLE  Handle,
OUT PHANDLE_DATA HandleData
 

Definition at line 1501 of file w32/ntcon/server/handle.c.

References CONSOLE_FREE_HANDLE, and Handle.

Referenced by CookedRead(), CookedReadWaitRoutine(), DirectReadWaitRoutine(), FindActiveScreenBufferHandle(), FreeIoHandle(), InitializeIoHandleTable(), ProcessCommandListInput(), ProcessCommandNumberInput(), ProcessCopyFromCharInput(), ProcessCopyToCharInput(), RawReadWaitRoutine(), RemoveConsole(), SrvCloseHandle(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), SrvGetHandleInformation(), SrvOpenConsole(), SrvSetHandleInformation(), and SrvVerifyConsoleIoHandle().

01509 : 01510 01511 This routine verifies a handle's validity, then returns a pointer to 01512 the handle data structure. 01513 01514 Arguments: 01515 01516 ProcessData - Pointer to per process data structure. 01517 01518 Handle - Handle to dereference. 01519 01520 HandleData - On return, pointer to handle data structure. 01521 01522 Return Value: 01523 01524 --*/ 01525 01526 { 01527 if (((ULONG_PTR)Handle >= ProcessData->HandleTableSize) || 01528 (ProcessData->HandleTablePtr[(ULONG_PTR)Handle].HandleType == CONSOLE_FREE_HANDLE) ) { 01529 return STATUS_INVALID_HANDLE; 01530 } 01531 *HandleData = &ProcessData->HandleTablePtr[(ULONG_PTR)Handle]; 01532 return STATUS_SUCCESS; 01533 }

VOID DestroyConsole IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1051 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_IN_DESTRUCTION, _CONSOLE_INFORMATION::ConsoleHandle, ConsoleHandles, ConsoleHeapFree, ConsoleLocked, FreeConsoleHandle(), IndexFromHandle, LockConsoleHandleTable, NULL, RtlDeleteCriticalSection(), and UnlockConsoleHandleTable.

Referenced by AbortCreateConsole(), DestroyWindowsWindow(), ProcessCtrlEvents(), and RevalidateConsole().

01057 : 01058 01059 This routine frees a console structure if it's not being referenced. 01060 01061 Arguments: 01062 01063 Console - Console to free. 01064 01065 Return Value: 01066 01067 01068 --*/ 01069 01070 { 01071 HANDLE ConsoleHandle = Console->ConsoleHandle; 01072 01073 // 01074 // Make sure we have the console locked and it really is going away. 01075 // 01076 01077 ASSERT(ConsoleLocked(Console)); 01078 ASSERT(Console->hWnd == NULL); 01079 01080 // 01081 // Mark this console as being destroyed. 01082 // 01083 01084 Console->Flags |= CONSOLE_IN_DESTRUCTION; 01085 01086 // 01087 // Unlock this console. 01088 // 01089 01090 RtlLeaveCriticalSection(&Console->ConsoleLock); 01091 01092 // 01093 // If the console still exists and no one is waiting on it, free it. 01094 // 01095 01096 LockConsoleHandleTable(); 01097 if (Console == ConsoleHandles[IndexFromHandle(ConsoleHandle)] && 01098 Console->ConsoleHandle == ConsoleHandle && 01099 Console->ConsoleLock.OwningThread == NULL && 01100 Console->WaitCount == 0) { 01101 01102 FreeConsoleHandle(ConsoleHandle); 01103 RtlDeleteCriticalSection(&Console->ConsoleLock); 01104 ConsoleHeapFree(Console); 01105 } 01106 UnlockConsoleHandleTable(); 01107 }

VOID DestroyWindowsWindow IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 4454 of file output.c.

References ASSERT, CleanupConsoleMessages(), ClearKeyInfo(), CloseWindowStation, CONIME_DESTROY, CONSOLE_IS_IME_ENABLED, CONSOLE_NO_WINDOW, CONSOLE_VDM_REGISTERED, ConsoleHeapFree, CURSOR_TIMER, DeleteEUDC(), DestroyConsole(), DestroyFontCache(), DestroyIcon, DestroyWindow, FreeAliasBuffers(), FreeCommandHistoryBuffers(), FreeInputBuffer(), FreeLocalEUDC(), FreeScreenBuffer(), ghDefaultIcon, ghDefaultSmIcon, gnConsoleWindows, hWnd, INITIALIZATION_FAILED, INITIALIZATION_SUCCEEDED, _SCREEN_INFORMATION::Next, NtClose(), NULL, ReleaseDC(), ReplyMessage(), SendMessage(), and SetWindowConsole.

Referenced by ConsoleWindowProc().

04457 { 04458 PSCREEN_INFORMATION Cur,Next; 04459 HWND hWnd = Console->hWnd; 04460 04461 gnConsoleWindows--; 04462 Console->InputThreadInfo->WindowCount--; 04463 04464 SetWindowConsole(hWnd, NULL); 04465 04466 KillTimer(Console->hWnd,CURSOR_TIMER); 04467 04468 if (Console->hWndProperties) { 04469 SendMessage(Console->hWndProperties, WM_CLOSE, 0, 0); 04470 } 04471 04472 // FE_SB 04473 if (Console->FonthDC) { 04474 ReleaseDC(NULL, Console->FonthDC); 04475 DeleteObject(Console->hBitmap); 04476 } 04477 DeleteEUDC(Console); 04478 04479 // FE_IME 04480 if (CONSOLE_IS_IME_ENABLED()) { 04481 if (!(Console->Flags & CONSOLE_NO_WINDOW)) { 04482 // v-HirShi Jul.4.1995 For console IME 04483 KillTimer(Console->hWnd, SCROLL_WAIT_TIMER); 04484 } 04485 ConsoleImeMessagePump(Console, 04486 CONIME_DESTROY, 04487 (WPARAM)Console->ConsoleHandle, 04488 (LPARAM)NULL 04489 ); 04490 } 04491 // end FE_IME 04492 // end FE_SB 04493 04494 CleanupConsoleMessages(Console); 04495 04496 ReleaseDC(NULL, Console->hDC); 04497 Console->hDC = NULL; 04498 04499 DestroyWindow(Console->hWnd); 04500 Console->hWnd = NULL; 04501 04502 // 04503 // Tell the worker thread that the window is destroyed. 04504 // 04505 04506 ReplyMessage(0); 04507 04508 // 04509 // Clear out any keyboard messages we have stored away. 04510 // 04511 04512 ClearKeyInfo(hWnd); 04513 04514 if (Console->hIcon != NULL && Console->hIcon != ghDefaultIcon) { 04515 DestroyIcon(Console->hIcon); 04516 } 04517 if (Console->hSmIcon != NULL && Console->hSmIcon != ghDefaultSmIcon) { 04518 DestroyIcon(Console->hSmIcon); 04519 } 04520 04521 // 04522 // must keep this thread handle around until after the destroywindow 04523 // call so that impersonation will work. 04524 // 04525 04526 CloseHandle(Console->ClientThreadHandle); 04527 04528 // 04529 // once the sendmessage returns, there will be no more input to 04530 // the console so we don't need to lock it. 04531 // also, we've freed the console handle, so no apis may access the console. 04532 // 04533 04534 // 04535 // free screen buffers 04536 // 04537 04538 for (Cur=Console->ScreenBuffers;Cur!=NULL;Cur=Next) { 04539 Next = Cur->Next; 04540 FreeScreenBuffer(Cur); 04541 } 04542 04543 FreeAliasBuffers(Console); 04544 FreeCommandHistoryBuffers(Console); 04545 04546 // 04547 // free input buffer 04548 // 04549 04550 FreeInputBuffer(&Console->InputBuffer); 04551 ConsoleHeapFree(Console->Title); 04552 ConsoleHeapFree(Console->OriginalTitle); 04553 NtClose(Console->InitEvents[INITIALIZATION_SUCCEEDED]); 04554 NtClose(Console->InitEvents[INITIALIZATION_FAILED]); 04555 NtClose(Console->TerminationEvent); 04556 if (Console->hWinSta != NULL) { 04557 CloseDesktop(Console->hDesk); 04558 CloseWindowStation(Console->hWinSta); 04559 } 04560 if (Console->VDMProcessHandle) 04561 CloseHandle(Console->VDMProcessHandle); 04562 ASSERT(!(Console->Flags & CONSOLE_VDM_REGISTERED)); 04563 /*if (Console->VDMBuffer != NULL) { 04564 NtUnmapViewOfSection(NtCurrentProcess(),Console->VDMBuffer); 04565 NtClose(Console->VDMBufferSectionHandle); 04566 }*/ 04567 #if defined(FE_SB) 04568 FreeLocalEUDC(Console); 04569 DestroyFontCache(Console->FontCacheInformation); 04570 #endif 04571 DestroyConsole(Console); 04572 }

VOID DoCopy IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 807 of file ntcon/server/clipbrd.c.

References ClearSelection(), and StoreSelection().

Referenced by ConsoleWindowProc(), HandleKeyEvent(), and HandleMouseEvent().

00810 { 00811 StoreSelection(Console); // store selection in clipboard 00812 ClearSelection(Console); // clear selection in console 00813 }

NTSTATUS DoCreateScreenBuffer IN PCONSOLE_INFORMATION  Console,
IN PCONSOLE_INFO  ConsoleInfo
 

Definition at line 270 of file output.c.

References CONSOLE_AUTO_POSITION, CONSOLE_DEFAULT_BUFFER_SIZE, CONSOLE_HISTORY_NODUP, CONSOLE_IS_DBCS_ENABLED, CONSOLE_NO_WINDOW, CONSOLE_QUICK_EDIT_MODE, CONSOLE_TEXTMODE_BUFFER, CONSOLE_USE_PRIVATE_FLAGS, CreateScreenBuffer(), DbgPrint, FALSE, FindCreateFont(), FontInfo, FullScreenInitialized, guCaretBlinkTime, INT, IsAvailableFarEastCodePage(), min, NTSTATUS(), NULL, SHORT, _FONT_INFO::Size, and Status.

Referenced by AllocateConsole().

00283 { 00284 CHAR_INFO Fill,PopupFill; 00285 COORD dwScreenBufferSize, dwWindowSize; 00286 NTSTATUS Status; 00287 int FontIndexWant; 00288 00289 if (ConsoleInfo->dwStartupFlags & STARTF_USESHOWWINDOW) { 00290 Console->wShowWindow = ConsoleInfo->wShowWindow; 00291 } else { 00292 Console->wShowWindow = SW_SHOWNORMAL; 00293 } 00294 00295 #if 0 00296 { 00297 00298 INT i; 00299 00300 DbgPrint("[Link Server Properties for %ws]\n", ConsoleTitle ); 00301 DbgPrint(" wFillAttribute = 0x%04X\n", ConsoleInfo->wFillAttribute ); 00302 DbgPrint(" wPopupFillAttribute = 0x%04X\n", ConsoleInfo->wPopupFillAttribute ); 00303 DbgPrint(" dwScreenBufferSize = (%d , %d)\n", ConsoleInfo->dwScreenBufferSize.X, ConsoleInfo->dwScreenBufferSize.Y ); 00304 DbgPrint(" dwWindowSize = (%d , %d)\n", ConsoleInfo->dwWindowSize.X, ConsoleInfo->dwWindowSize.Y ); 00305 DbgPrint(" dwWindowOrigin = (%d , %d)\n", ConsoleInfo->dwWindowOrigin.X, ConsoleInfo->dwWindowOrigin.Y ); 00306 DbgPrint(" nFont = %d\n", ConsoleInfo->nFont ); 00307 DbgPrint(" nInputBufferSize = %d\n", ConsoleInfo->nInputBufferSize ); 00308 DbgPrint(" dwFontSize = (%d , %d)\n", ConsoleInfo->dwFontSize.X, ConsoleInfo->dwFontSize.Y ); 00309 DbgPrint(" uFontFamily = 0x%08X\n", ConsoleInfo->uFontFamily ); 00310 DbgPrint(" uFontWeight = 0x%08X\n", ConsoleInfo->uFontWeight ); 00311 DbgPrint(" FaceName = %ws\n", ConsoleInfo->FaceName ); 00312 DbgPrint(" uCursorSize = %d\n", ConsoleInfo->uCursorSize ); 00313 DbgPrint(" bFullScreen = %s\n", ConsoleInfo->bFullScreen ? "TRUE" : "FALSE" ); 00314 DbgPrint(" bQuickEdit = %s\n", ConsoleInfo->bQuickEdit ? "TRUE" : "FALSE" ); 00315 DbgPrint(" bInsertMode = %s\n", ConsoleInfo->bInsertMode ? "TRUE" : "FALSE" ); 00316 DbgPrint(" bAutoPosition = %s\n", ConsoleInfo->bAutoPosition ? "TRUE" : "FALSE" ); 00317 DbgPrint(" uHistoryBufferSize = %d\n", ConsoleInfo->uHistoryBufferSize ); 00318 DbgPrint(" uNumHistoryBuffers = %d\n", ConsoleInfo->uNumberOfHistoryBuffers ); 00319 DbgPrint(" bHistoryNoDup = %s\n", ConsoleInfo->bHistoryNoDup ? "TRUE" : "FALSE" ); 00320 DbgPrint(" ColorTable = [" ); 00321 i=0; 00322 while( i < 16 ) 00323 { 00324 DbgPrint("\n "); 00325 DbgPrint("0x%08X ", ConsoleInfo->ColorTable[i++]); 00326 DbgPrint("0x%08X ", ConsoleInfo->ColorTable[i++]); 00327 DbgPrint("0x%08X ", ConsoleInfo->ColorTable[i++]); 00328 DbgPrint("0x%08X ", ConsoleInfo->ColorTable[i++]); 00329 } 00330 DbgPrint( "]\n\n" ); 00331 } 00332 #endif 00333 00334 // 00335 // Get values from consoleinfo (which was initialized through link) 00336 // 00337 00338 Fill.Attributes = ConsoleInfo->wFillAttribute; 00339 Fill.Char.UnicodeChar = (WCHAR)' '; 00340 PopupFill.Attributes = ConsoleInfo->wPopupFillAttribute; 00341 PopupFill.Char.UnicodeChar = (WCHAR)' '; 00342 00343 dwScreenBufferSize = ConsoleInfo->dwScreenBufferSize; 00344 if (!(ConsoleInfo->dwStartupFlags & STARTF_USECOUNTCHARS)) { 00345 if (Console->Flags & CONSOLE_NO_WINDOW) { 00346 dwScreenBufferSize.X = min(dwScreenBufferSize.X, 80); 00347 dwScreenBufferSize.Y = min(dwScreenBufferSize.Y, 25); 00348 } 00349 } 00350 if (dwScreenBufferSize.X == 0) 00351 dwScreenBufferSize.X = 1; 00352 if (dwScreenBufferSize.Y == 0) 00353 dwScreenBufferSize.Y = 1; 00354 00355 // 00356 // Grab font 00357 // 00358 #if defined(FE_SB) 00359 FontIndexWant = FindCreateFont(ConsoleInfo->uFontFamily, 00360 ConsoleInfo->FaceName, 00361 ConsoleInfo->dwFontSize, 00362 ConsoleInfo->uFontWeight, 00363 ConsoleInfo->uCodePage 00364 ); 00365 #else 00366 FontIndexWant = FindCreateFont(ConsoleInfo->uFontFamily, 00367 ConsoleInfo->FaceName, 00368 ConsoleInfo->dwFontSize, 00369 ConsoleInfo->uFontWeight); 00370 #endif 00371 00372 // 00373 // grab window size information 00374 // 00375 00376 dwWindowSize = ConsoleInfo->dwWindowSize; 00377 if (ConsoleInfo->dwStartupFlags & STARTF_USESIZE) { 00378 dwWindowSize.X /= FontInfo[FontIndexWant].Size.X; 00379 dwWindowSize.Y /= FontInfo[FontIndexWant].Size.Y; 00380 } else if (Console->Flags & CONSOLE_NO_WINDOW) { 00381 dwWindowSize.X = min(dwWindowSize.X, 80); 00382 dwWindowSize.Y = min(dwWindowSize.Y, 25); 00383 } 00384 if (dwWindowSize.X == 0) 00385 dwWindowSize.X = 1; 00386 if (dwWindowSize.Y == 0) 00387 dwWindowSize.Y = 1; 00388 00389 if (dwScreenBufferSize.X < dwWindowSize.X) 00390 dwScreenBufferSize.X = dwWindowSize.X; 00391 if (dwScreenBufferSize.Y < dwWindowSize.Y) 00392 dwScreenBufferSize.Y = dwWindowSize.Y; 00393 00394 Console->dwWindowOriginX = ConsoleInfo->dwWindowOrigin.X; 00395 Console->dwWindowOriginY = ConsoleInfo->dwWindowOrigin.Y; 00396 00397 if (ConsoleInfo->bAutoPosition) { 00398 Console->Flags |= CONSOLE_AUTO_POSITION; 00399 Console->dwWindowOriginX = CW_USEDEFAULT; 00400 } else { 00401 Console->WindowRect.left = Console->dwWindowOriginX; 00402 Console->WindowRect.top = Console->dwWindowOriginY; 00403 Console->WindowRect.right = Console->dwWindowOriginX + dwWindowSize.X * FontInfo[FontIndexWant].Size.X; 00404 Console->WindowRect.bottom = Console->dwWindowOriginY + dwWindowSize.Y * FontInfo[FontIndexWant].Size.Y; 00405 } 00406 00407 #ifdef i386 00408 if (FullScreenInitialized) { 00409 if (ConsoleInfo->bFullScreen) { 00410 Console->FullScreenFlags = CONSOLE_FULLSCREEN; 00411 } 00412 } 00413 #endif 00414 if (ConsoleInfo->bQuickEdit) { 00415 Console->Flags |= CONSOLE_QUICK_EDIT_MODE; 00416 } 00417 Console->Flags |= CONSOLE_USE_PRIVATE_FLAGS; 00418 00419 Console->InsertMode = (ConsoleInfo->bInsertMode != FALSE); 00420 Console->CommandHistorySize = (SHORT)ConsoleInfo->uHistoryBufferSize; 00421 Console->MaxCommandHistories = (SHORT)ConsoleInfo->uNumberOfHistoryBuffers; 00422 if (ConsoleInfo->bHistoryNoDup) { 00423 Console->Flags |= CONSOLE_HISTORY_NODUP; 00424 } else { 00425 Console->Flags &= ~CONSOLE_HISTORY_NODUP; 00426 } 00427 RtlCopyMemory(Console->ColorTable, ConsoleInfo->ColorTable, sizeof( Console->ColorTable )); 00428 00429 #if defined(FE_SB) 00430 // for FarEast version, we want get the code page from registry or shell32, 00431 // so we can specify console codepage by console.cpl or shell32 00432 // default codepage is OEMCP. scotthsu 00433 Console->CP = ConsoleInfo->uCodePage; 00434 Console->OutputCP = ConsoleInfo->uCodePage; 00435 #if 0 00436 if (CONSOLE_IS_DBCS_ENABLED()){ 00437 Console->fIsDBCSCP = !!IsAvailableFarEastCodePage(Console->CP); 00438 Console->fIsDBCSOutputCP = !!IsAvailableFarEastCodePage(Console->OutputCP); 00439 } 00440 else { 00441 Console->fIsDBCSCP = FALSE; 00442 Console->fIsDBCSOutputCP = FALSE; 00443 } 00444 #else 00445 Console->fIsDBCSCP = CONSOLE_IS_DBCS_ENABLED() && IsAvailableFarEastCodePage(Console->CP); 00446 Console->fIsDBCSOutputCP = CONSOLE_IS_DBCS_ENABLED() && IsAvailableFarEastCodePage(Console->OutputCP); 00447 #endif 00448 #endif 00449 #if defined(FE_IME) 00450 Console->ConsoleIme.ScrollWaitTimeout = guCaretBlinkTime * 2; 00451 #endif 00452 TryNewSize: 00453 Status = CreateScreenBuffer(&Console->ScreenBuffers, 00454 dwWindowSize, 00455 FontIndexWant, 00456 dwScreenBufferSize, 00457 Fill, 00458 PopupFill, 00459 Console, 00460 CONSOLE_TEXTMODE_BUFFER, 00461 NULL, 00462 NULL, 00463 NULL, 00464 ConsoleInfo->uCursorSize, 00465 ConsoleInfo->FaceName 00466 ); 00467 if (Status == STATUS_NO_MEMORY) { 00468 // 00469 // If we failed to create a large buffer, try again with a small one. 00470 // 00471 if (dwScreenBufferSize.X > 80 || dwScreenBufferSize.Y > 50) { 00472 dwScreenBufferSize.X = min(dwScreenBufferSize.X, 80); 00473 dwScreenBufferSize.Y = min(dwScreenBufferSize.Y, 50); 00474 dwWindowSize.X = min(dwWindowSize.X, dwScreenBufferSize.X); 00475 dwWindowSize.Y = min(dwWindowSize.Y, dwScreenBufferSize.Y); 00476 Console->Flags |= CONSOLE_DEFAULT_BUFFER_SIZE; 00477 goto TryNewSize; 00478 } 00479 } 00480 00481 return Status; 00482 }

VOID DoDrop IN WPARAM  wParam,
IN PCONSOLE_INFORMATION  Console
 

VOID DoFind IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 268 of file find.c.

References FindDialogProc(), ghInstance, and ID_FINDDLG.

Referenced by ConsoleWindowProc().

00271 { 00272 DialogBoxParam(ghInstance, 00273 MAKEINTRESOURCE(ID_FINDDLG), 00274 Console->hWnd, 00275 FindDialogProc, 00276 (LPARAM)Console); 00277 }

BOOL DoFontEnum IN HDC hDC  OPTIONAL,
IN LPWSTR pwszFace  OPTIONAL,
IN SHORT  TTPointSize
 

VOID DoMark IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1167 of file ntcon/server/clipbrd.c.

References InitSelection().

Referenced by ConsoleWindowProc().

01170 { 01171 InitSelection(Console); // initialize selection 01172 }

VOID DoPaste IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1008 of file ntcon/server/clipbrd.c.

References BOOL, _SCREEN_INFORMATION::BufferInfo, CloseClipboard, CONSOLE_SCROLLING, CONSOLE_TEXTMODE_BUFFER, DoStringPaste(), FALSE, GetClipboardData(), NtReleaseMutant(), NtWaitForSingleObject(), NULL, and OpenClipboard().

Referenced by ConsoleWindowProc(), and HandleMouseEvent().

01019 { 01020 BOOL Success; 01021 HANDLE ClipboardDataHandle; 01022 01023 if (Console->Flags & CONSOLE_SCROLLING) { 01024 return; 01025 } 01026 01027 // 01028 // Get paste data from clipboard 01029 // 01030 01031 Success = OpenClipboard(Console->hWnd); 01032 if (!Success) 01033 return; 01034 01035 if (Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 01036 PWCHAR pwstr; 01037 01038 ClipboardDataHandle = GetClipboardData(CF_UNICODETEXT); 01039 if (ClipboardDataHandle == NULL) { 01040 CloseClipboard(); // Close clipboard 01041 return; 01042 } 01043 pwstr = GlobalLock(ClipboardDataHandle); 01044 DoStringPaste(Console,pwstr,(ULONG)GlobalSize(ClipboardDataHandle)/sizeof(WCHAR)); 01045 GlobalUnlock(ClipboardDataHandle); 01046 01047 } else { 01048 HBITMAP hBitmapSource,hBitmapTarget; 01049 HDC hDCMemSource,hDCMemTarget; 01050 BITMAP bm; 01051 PSCREEN_INFORMATION ScreenInfo; 01052 01053 hBitmapSource = GetClipboardData(CF_BITMAP); 01054 if (hBitmapSource) { 01055 01056 ScreenInfo = Console->CurrentScreenBuffer; 01057 NtWaitForSingleObject(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, 01058 FALSE, NULL); 01059 01060 hBitmapTarget = CreateDIBitmap(Console->hDC, 01061 &ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo->bmiHeader, 01062 CBM_INIT, 01063 ScreenInfo->BufferInfo.GraphicsInfo.BitMap, 01064 ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo, 01065 ScreenInfo->BufferInfo.GraphicsInfo.dwUsage 01066 ); 01067 if (hBitmapTarget) { 01068 hDCMemTarget = CreateCompatibleDC ( Console->hDC ); 01069 hDCMemSource = CreateCompatibleDC ( Console->hDC ); 01070 SelectObject( hDCMemTarget, hBitmapTarget ); 01071 SelectObject( hDCMemSource, hBitmapSource ); 01072 GetObjectW(hBitmapSource, sizeof (BITMAP), (LPSTR) &bm); 01073 BitBlt ( hDCMemTarget, 0, 0, bm.bmWidth, bm.bmHeight, 01074 hDCMemSource, 0, 0, SRCCOPY); 01075 GetObjectW(hBitmapTarget, sizeof (BITMAP), (LPSTR) &bm); 01076 01077 // copy the bits from the DC to memory 01078 01079 GetDIBits(hDCMemTarget, hBitmapTarget, 0, bm.bmHeight, 01080 ScreenInfo->BufferInfo.GraphicsInfo.BitMap, 01081 ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo, 01082 ScreenInfo->BufferInfo.GraphicsInfo.dwUsage); 01083 DeleteDC(hDCMemSource); 01084 DeleteDC(hDCMemTarget); 01085 DeleteObject(hBitmapTarget); 01086 InvalidateRect(Console->hWnd,NULL,FALSE); // force repaint 01087 } 01088 NtReleaseMutant(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, NULL); 01089 } 01090 } 01091 CloseClipboard(); 01092 return; 01093 }

VOID DoScroll IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1211 of file ntcon/server/clipbrd.c.

References CONSOLE_SCROLLING, msgScrollMode, SetWinText(), and TRUE.

Referenced by ConsoleWindowProc().

01214 { 01215 if (!(Console->Flags & CONSOLE_SCROLLING)) { 01216 SetWinText(Console,msgScrollMode,TRUE); 01217 Console->Flags |= CONSOLE_SCROLLING; 01218 } 01219 }

VOID DoSelectAll IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1175 of file ntcon/server/clipbrd.c.

References _SCREEN_INFORMATION::BufferInfo, ClearSelection(), CONSOLE_MOUSE_SELECTION, CONSOLE_SELECTING, CONSOLE_SELECTION_NOT_EMPTY, ExtendSelection(), msgSelectMode, MyInvert(), _SCREEN_INFORMATION::ScreenBufferSize, SetWindowOrigin(), SetWinText(), TRUE, and _SCREEN_INFORMATION::Window.

Referenced by ConsoleWindowProc().

01178 { 01179 COORD Position; 01180 COORD WindowOrigin; 01181 PSCREEN_INFORMATION ScreenInfo; 01182 01183 // clear any old selections 01184 if (Console->Flags & CONSOLE_SELECTING) { 01185 ClearSelection(Console); 01186 } 01187 01188 // save the old window position 01189 ScreenInfo = Console->CurrentScreenBuffer; 01190 WindowOrigin.X = ScreenInfo->Window.Left; 01191 WindowOrigin.Y = ScreenInfo->Window.Top; 01192 01193 // initialize selection 01194 Console->Flags |= CONSOLE_SELECTING; 01195 Console->SelectionFlags = CONSOLE_MOUSE_SELECTION | CONSOLE_SELECTION_NOT_EMPTY; 01196 Console->SelectionAnchor.X = Console->SelectionRect.Left = Console->SelectionRect.Right = 0; 01197 Console->SelectionAnchor.Y = Console->SelectionRect.Top = Console->SelectionRect.Bottom = 0; 01198 MyInvert(Console,&Console->SelectionRect); 01199 SetWinText(Console,msgSelectMode,TRUE); 01200 01201 // extend selection 01202 Position.X = ScreenInfo->ScreenBufferSize.X - 1; 01203 Position.Y = ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y; 01204 ExtendSelection(Console, Position); 01205 01206 // restore the old window position 01207 SetWindowOrigin(ScreenInfo, TRUE, WindowOrigin); 01208 }

VOID DoStringPaste IN PCONSOLE_INFORMATION  Console,
IN PWCHAR  pwStr,
IN UINT  DataSize
 

Definition at line 835 of file ntcon/server/clipbrd.c.

References BOOL, BYTE, CHAR, CONSOLE_IS_DBCS_ENABLED, ConsoleHeapAlloc, ConsoleHeapFree, ConvertToOem(), DATA_CHUNK_SIZE, DWORD, FALSE, HIBYTE, LoadKeyEvent, LOBYTE, MAKE_TAG, MapVirtualKey(), NULL, SHORT, TMP_TAG, TRUE, UNICODE_CARRIAGERETURN, UNICODE_LINEFEED, VkKeyScan(), and WriteInputBuffer().

Referenced by DoDrop(), and DoPaste().

00840 { 00841 PINPUT_RECORD StringData,CurRecord; 00842 PWCHAR CurChar; 00843 WCHAR Char; 00844 DWORD i; 00845 DWORD ChunkSize,j; 00846 ULONG EventsWritten; 00847 00848 00849 if(!pwStr) { 00850 return; 00851 } 00852 00853 if (DataSize > DATA_CHUNK_SIZE) { 00854 ChunkSize = DATA_CHUNK_SIZE; 00855 } else { 00856 ChunkSize = DataSize; 00857 } 00858 00859 // 00860 // allocate space to copy data. 00861 // 00862 00863 StringData = (PINPUT_RECORD)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),ChunkSize*sizeof(INPUT_RECORD)*8); // 8 is maximum number of events per char 00864 if (StringData == NULL) { 00865 return; 00866 } 00867 00868 // 00869 // transfer data to the input buffer in chunks 00870 // 00871 00872 CurChar = pwStr; // LATER remove this 00873 for (j = 0; j < DataSize; j += ChunkSize) { 00874 if (ChunkSize > DataSize - j) { 00875 ChunkSize = DataSize - j; 00876 } 00877 CurRecord = StringData; 00878 for (i = 0, EventsWritten = 0; i < ChunkSize; i++) { 00879 // filter out LF if not first char and preceded by CR 00880 Char = *CurChar; 00881 if (Char != UNICODE_LINEFEED || (i==0 && j==0) || (*(CurChar-1)) != UNICODE_CARRIAGERETURN) { 00882 SHORT KeyState; 00883 BYTE KeyFlags; 00884 BOOL AltGr=FALSE; 00885 BOOL Shift=FALSE; 00886 00887 if (Char == 0) { 00888 j = DataSize; 00889 break; 00890 } 00891 00892 KeyState = VkKeyScan(Char); 00893 #if defined(FE_SB) 00894 if (CONSOLE_IS_DBCS_ENABLED() && 00895 (KeyState == -1)) { 00896 WORD CharType; 00897 // 00898 // Determine DBCS character because these character doesn't know by VkKeyScan. 00899 // GetStringTypeW(CT_CTYPE3) & C3_ALPHA can determine all linguistic characters. 00900 // However, this is not include symbolic character for DBCS. 00901 // IsConsoleFullWidth can help for DBCS symbolic character. 00902 // 00903 GetStringTypeW(CT_CTYPE3,&Char,1,&CharType); 00904 if ((CharType & C3_ALPHA) || 00905 IsConsoleFullWidth(Console->hDC,Console->OutputCP,Char)) { 00906 KeyState = 0; 00907 } 00908 } 00909 #endif 00910 00911 // if VkKeyScanW fails (char is not in kbd layout), we must 00912 // emulate the key being input through the numpad 00913 00914 if (KeyState == -1) { 00915 CHAR CharString[4]; 00916 UCHAR OemChar; 00917 PCHAR pCharString; 00918 00919 ConvertToOem(Console->OutputCP, 00920 &Char, 00921 1, 00922 &OemChar, 00923 1 00924 ); 00925 00926 _itoa(OemChar, CharString, 10); 00927 00928 EventsWritten++; 00929 LoadKeyEvent(CurRecord,TRUE,0,VK_MENU,0x38,LEFT_ALT_PRESSED); 00930 CurRecord++; 00931 00932 for (pCharString=CharString;*pCharString;pCharString++) { 00933 WORD wVirtualKey, wScancode; 00934 EventsWritten++; 00935 wVirtualKey = *pCharString-'0'+VK_NUMPAD0; 00936 wScancode = (WORD)MapVirtualKey(wVirtualKey, 0); 00937 LoadKeyEvent(CurRecord,TRUE,0,wVirtualKey,wScancode,LEFT_ALT_PRESSED); 00938 CurRecord++; 00939 EventsWritten++; 00940 LoadKeyEvent(CurRecord,FALSE,0,wVirtualKey,wScancode,LEFT_ALT_PRESSED); 00941 CurRecord++; 00942 } 00943 00944 EventsWritten++; 00945 LoadKeyEvent(CurRecord,FALSE,Char,VK_MENU,0x38,0); 00946 CurRecord++; 00947 } else { 00948 KeyFlags = HIBYTE(KeyState); 00949 00950 // handle yucky alt-gr keys 00951 if ((KeyFlags & 6) == 6) { 00952 AltGr=TRUE; 00953 EventsWritten++; 00954 LoadKeyEvent(CurRecord,TRUE,0,VK_MENU,0x38,ENHANCED_KEY | LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED); 00955 CurRecord++; 00956 } else if (KeyFlags & 1) { 00957 Shift=TRUE; 00958 EventsWritten++; 00959 LoadKeyEvent(CurRecord,TRUE,0,VK_SHIFT,0x2a,SHIFT_PRESSED); 00960 CurRecord++; 00961 } 00962 00963 EventsWritten++; 00964 LoadKeyEvent(CurRecord, 00965 TRUE, 00966 Char, 00967 LOBYTE(KeyState), 00968 (WORD)MapVirtualKey(CurRecord->Event.KeyEvent.wVirtualKeyCode,0), 00969 0); 00970 if (KeyFlags & 1) 00971 CurRecord->Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED; 00972 if (KeyFlags & 2) 00973 CurRecord->Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; 00974 if (KeyFlags & 4) 00975 CurRecord->Event.KeyEvent.dwControlKeyState |= RIGHT_ALT_PRESSED; 00976 CurRecord++; 00977 00978 EventsWritten++; 00979 *CurRecord = *(CurRecord-1); 00980 CurRecord->Event.KeyEvent.bKeyDown = FALSE; 00981 CurRecord++; 00982 00983 // handle yucky alt-gr keys 00984 if (AltGr) { 00985 EventsWritten++; 00986 LoadKeyEvent(CurRecord,FALSE,0,VK_MENU,0x38,ENHANCED_KEY); 00987 CurRecord++; 00988 } else if (Shift) { 00989 EventsWritten++; 00990 LoadKeyEvent(CurRecord,FALSE,0,VK_SHIFT,0x2a,0); 00991 CurRecord++; 00992 } 00993 } 00994 } 00995 CurChar++; 00996 } 00997 EventsWritten = WriteInputBuffer(Console, 00998 &Console->InputBuffer, 00999 StringData, 01000 EventsWritten 01001 ); 01002 } 01003 ConsoleHeapFree(StringData); 01004 return; 01005 }

NTSTATUS EnumerateFonts DWORD  Flags  ) 
 

Definition at line 515 of file w32/ntcon/server/misc.c.

References AddFaceNode(), ASSERT, tagFACENODE::awch, CONSOLE_IS_DBCS_ENABLED, ConsoleHeapAlloc, DBGFONTS, DefaultFaceName, DefaultFontFamily, DefaultFontIndex, DefaultFontSize, DoFontEnum(), tagFACENODE::dwFlag, DWORD, EF_DEFFACE, EF_ENUMERATED, EF_NEW, EF_OEMFONT, EF_OLD, EF_TTFONT, _FONT_INFO::Family, FONT_TAG, FontInfo, FontInfoLength, gpFaceNames, INITIAL_FONTS, L, MAKE_TAG, NULL, NumberOfFonts, tagFACENODE::pNext, SHORT, and _FONT_INFO::Size.

Referenced by ConsoleInputThread().

00517 { 00518 TEXTMETRIC tmi; 00519 HDC hDC; 00520 PFACENODE pFN; 00521 ULONG ulOldEnumFilter; 00522 DWORD FontIndex; 00523 DWORD dwFontType = 0; 00524 00525 DBGFONTS(("EnumerateFonts %lx\n", Flags)); 00526 00527 dwFontType = (EF_TTFONT|EF_OEMFONT|EF_DEFFACE) & Flags; 00528 00529 if (FontInfo == NULL) { 00530 // 00531 // allocate memory for the font array 00532 // 00533 NumberOfFonts = 0; 00534 00535 FontInfo = (PFONT_INFO)ConsoleHeapAlloc(MAKE_TAG( FONT_TAG ),sizeof(FONT_INFO) * INITIAL_FONTS); 00536 if (FontInfo == NULL) 00537 return STATUS_NO_MEMORY; 00538 FontInfoLength = INITIAL_FONTS; 00539 } 00540 00541 hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); 00542 00543 // Before enumeration, turn off font enumeration filters. 00544 ulOldEnumFilter = SetFontEnumeration(0); 00545 // restore all the other flags 00546 SetFontEnumeration(ulOldEnumFilter & ~FE_FILTER_TRUETYPE); 00547 00548 if (Flags & EF_DEFFACE) { 00549 SelectObject(hDC,GetStockObject(OEM_FIXED_FONT)); 00550 00551 if (GetTextMetricsW(hDC, &tmi)) { 00552 DefaultFontSize.X = (SHORT)(tmi.tmMaxCharWidth); 00553 DefaultFontSize.Y = (SHORT)(tmi.tmHeight+tmi.tmExternalLeading); 00554 DefaultFontFamily = tmi.tmPitchAndFamily; 00555 #if defined(FE_SB) 00556 if (IS_ANY_DBCS_CHARSET(tmi.tmCharSet)) 00557 DefaultFontSize.X /= 2; 00558 #endif 00559 } 00560 GetTextFaceW(hDC, LF_FACESIZE, DefaultFaceName); 00561 #if defined(FE_SB) 00562 DBGFONTS(("Default (OEM) Font %ls (%d,%d) CharSet 0x%02X\n", DefaultFaceName, 00563 DefaultFontSize.X, DefaultFontSize.Y, 00564 tmi.tmCharSet)); 00565 #else 00566 DBGFONTS(("Default (OEM) Font %ls (%d,%d)\n", DefaultFaceName, 00567 DefaultFontSize.X, DefaultFontSize.Y)); 00568 #endif 00569 00570 // Make sure we are going to enumerate the OEM face. 00571 pFN = AddFaceNode(&gpFaceNames, DefaultFaceName); 00572 pFN->dwFlag |= EF_DEFFACE | EF_OEMFONT; 00573 } 00574 00575 // Use DoFontEnum to get all fonts from the system. Our FontEnum 00576 // proc puts just the ones we want into an array 00577 // 00578 for (pFN = gpFaceNames; pFN; pFN = pFN->pNext) { 00579 DBGFONTS(("\"%ls\" is %s%s%s%s%s%s\n", pFN->awch, 00580 pFN->dwFlag & EF_NEW ? "NEW " : " ", 00581 pFN->dwFlag & EF_OLD ? "OLD " : " ", 00582 pFN->dwFlag & EF_ENUMERATED ? "ENUMERATED " : " ", 00583 pFN->dwFlag & EF_OEMFONT ? "OEMFONT " : " ", 00584 pFN->dwFlag & EF_TTFONT ? "TTFONT " : " ", 00585 pFN->dwFlag & EF_DEFFACE ? "DEFFACE " : " ")); 00586 00587 if ((pFN->dwFlag & dwFontType) == 0) { 00588 // not the kind of face we want 00589 continue; 00590 } 00591 if (pFN->dwFlag & EF_ENUMERATED) { 00592 // we already enumerated this face 00593 continue; 00594 } 00595 00596 DoFontEnum(hDC, pFN->awch, DefaultFontSize.Y); 00597 pFN->dwFlag |= EF_ENUMERATED; 00598 } 00599 00600 00601 // After enumerating fonts, restore the font enumeration filter. 00602 SetFontEnumeration(ulOldEnumFilter); 00603 00604 DeleteDC(hDC); 00605 00606 // Make sure the default font is set correctly 00607 if (NumberOfFonts > 0 && DefaultFontSize.X == 0 && DefaultFontSize.Y == 0) { 00608 DefaultFontSize.X = FontInfo[0].Size.X; 00609 DefaultFontSize.Y = FontInfo[0].Size.Y; 00610 DefaultFontFamily = FontInfo[0].Family; 00611 } 00612 00613 for (FontIndex = 0; FontIndex < NumberOfFonts; FontIndex++) { 00614 if (FontInfo[FontIndex].Size.X == DefaultFontSize.X && 00615 FontInfo[FontIndex].Size.Y == DefaultFontSize.Y && 00616 FontInfo[FontIndex].Family == DefaultFontFamily) { 00617 #if defined(FE_SB) 00618 if (CONSOLE_IS_DBCS_ENABLED() && 00619 !IS_ANY_DBCS_CHARSET(FontInfo[FontIndex].tmCharSet)) 00620 { 00621 continue ; 00622 } 00623 #endif 00624 break; 00625 } 00626 } 00627 ASSERT(FontIndex < NumberOfFonts); 00628 if (FontIndex < NumberOfFonts) { 00629 DefaultFontIndex = FontIndex; 00630 } else { 00631 DefaultFontIndex = 0; 00632 } 00633 DBGFONTS(("EnumerateFonts : DefaultFontIndex = %ld\n", DefaultFontIndex)); 00634 00635 return STATUS_SUCCESS; 00636 }

VOID ExtendSelection IN PCONSOLE_INFORMATION  Console,
IN COORD  CursorPosition
 

Definition at line 178 of file ntcon/server/clipbrd.c.

References ASSERT, CON_FONTSIZE, CONSOLE_MOUSE_SELECTION, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_TEXTMODE_BUFFER, ConsoleHideCursor(), _SCREEN_INFORMATION::Flags, MakeCursorVisible(), MyInvert(), _SCREEN_INFORMATION::ScreenBufferSize, and _SCREEN_INFORMATION::Window.

Referenced by DoSelectAll(), HandleKeyEvent(), HandleMouseEvent(), and ScrollIfNecessary().

00189 { 00190 SMALL_RECT OldSelectionRect; 00191 HRGN OldRegion,NewRegion,CombineRegion; 00192 COORD FontSize; 00193 PSCREEN_INFORMATION ScreenInfo = Console->CurrentScreenBuffer; 00194 00195 if (CursorPosition.X < 0) { 00196 CursorPosition.X = 0; 00197 } else if (CursorPosition.X >= ScreenInfo->ScreenBufferSize.X) { 00198 CursorPosition.X = ScreenInfo->ScreenBufferSize.X-1; 00199 } 00200 00201 if (CursorPosition.Y < 0) { 00202 CursorPosition.Y = 0; 00203 } else if (CursorPosition.Y >= ScreenInfo->ScreenBufferSize.Y) { 00204 CursorPosition.Y = ScreenInfo->ScreenBufferSize.Y-1; 00205 } 00206 00207 if (!(Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY)) { 00208 00209 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00210 // scroll if necessary to make cursor visible. 00211 MakeCursorVisible(ScreenInfo, CursorPosition); 00212 ASSERT(!(Console->SelectionFlags & CONSOLE_MOUSE_SELECTION)); 00213 00214 // 00215 // if the selection rect hasn't actually been started, 00216 // the selection cursor is still blinking. turn it off. 00217 // 00218 00219 ConsoleHideCursor(ScreenInfo); 00220 } 00221 Console->SelectionFlags |= CONSOLE_SELECTION_NOT_EMPTY; 00222 Console->SelectionRect.Left =Console->SelectionRect.Right = Console->SelectionAnchor.X; 00223 Console->SelectionRect.Top = Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 00224 00225 // invert the cursor corner 00226 00227 #ifdef FE_SB 00228 if (!CONSOLE_IS_DBCS_OUTPUTCP(Console) && 00229 ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) 00230 #else 00231 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) 00232 #endif 00233 { 00234 MyInvert(Console,&Console->SelectionRect); 00235 } 00236 } else { 00237 00238 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00239 // scroll if necessary to make cursor visible. 00240 MakeCursorVisible(ScreenInfo,CursorPosition); 00241 } 00242 #ifdef FE_SB 00243 // 00244 // uninvert old selection 00245 // 00246 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 00247 MyInvert(Console, &Console->SelectionRect); 00248 } 00249 #endif // FE_SB 00250 } 00251 00252 // 00253 // update selection rect 00254 // 00255 00256 OldSelectionRect = Console->SelectionRect; 00257 if (CursorPosition.X <= Console->SelectionAnchor.X) { 00258 Console->SelectionRect.Left = CursorPosition.X; 00259 Console->SelectionRect.Right = Console->SelectionAnchor.X; 00260 } else if (CursorPosition.X > Console->SelectionAnchor.X) { 00261 Console->SelectionRect.Right = CursorPosition.X; 00262 Console->SelectionRect.Left = Console->SelectionAnchor.X; 00263 } 00264 if (CursorPosition.Y <= Console->SelectionAnchor.Y) { 00265 Console->SelectionRect.Top = CursorPosition.Y; 00266 Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 00267 } else if (CursorPosition.Y > Console->SelectionAnchor.Y) { 00268 Console->SelectionRect.Bottom = CursorPosition.Y; 00269 Console->SelectionRect.Top = Console->SelectionAnchor.Y; 00270 } 00271 00272 // 00273 // change inverted selection 00274 // 00275 #ifdef FE_SB 00276 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 00277 MyInvert(Console, &Console->SelectionRect); 00278 } else 00279 #endif 00280 { 00281 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00282 FontSize = CON_FONTSIZE(Console); 00283 } else { 00284 FontSize.X = 1; 00285 FontSize.Y = 1; 00286 } 00287 CombineRegion = CreateRectRgn(0,0,0,0); 00288 OldRegion = CreateRectRgn((OldSelectionRect.Left-ScreenInfo->Window.Left)*FontSize.X, 00289 (OldSelectionRect.Top-ScreenInfo->Window.Top)*FontSize.Y, 00290 (OldSelectionRect.Right-ScreenInfo->Window.Left+1)*FontSize.X, 00291 (OldSelectionRect.Bottom-ScreenInfo->Window.Top+1)*FontSize.Y 00292 ); 00293 NewRegion = CreateRectRgn((Console->SelectionRect.Left-ScreenInfo->Window.Left)*FontSize.X, 00294 (Console->SelectionRect.Top-ScreenInfo->Window.Top)*FontSize.Y, 00295 (Console->SelectionRect.Right-ScreenInfo->Window.Left+1)*FontSize.X, 00296 (Console->SelectionRect.Bottom-ScreenInfo->Window.Top+1)*FontSize.Y 00297 ); 00298 CombineRgn(CombineRegion,OldRegion,NewRegion,RGN_XOR); 00299 00300 InvertRgn(Console->hDC,CombineRegion); 00301 DeleteObject(OldRegion); 00302 DeleteObject(NewRegion); 00303 DeleteObject(CombineRegion); 00304 } 00305 }

NTSTATUS FalseUnicodeToRealUnicode IN OUT LPWSTR  Source,
IN int  SourceLength,
IN UINT  Codepage
 

Definition at line 1676 of file w32/ntcon/server/misc.c.

References BOOL, CHAR, CONSOLE_IS_DBCS_ENABLED, ConsoleHeapAlloc, ConsoleHeapFree, DBGCHARS, FALSE, GlyphCP, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, RtlCustomCPToUnicodeN(), RtlUnicodeToMultiByteN(), STACK_BUFFER_SIZE, Status, TMP_TAG, TRUE, USACP, USHORT, and WINDOWSCP.

Referenced by ConvertToFullScreen(), DrawCommandListPopup(), ReadOutputString(), SB_TranslateOutputToOemUnicode(), SetScreenBufferFont(), and StoreSelection().

01689 { 01690 NTSTATUS Status; 01691 LPSTR Temp; 01692 ULONG TempLength; 01693 ULONG Length; 01694 CHAR StackBuffer[STACK_BUFFER_SIZE]; 01695 BOOL NormalChars; 01696 int i; 01697 01698 DBGCHARS(("UnicodeAnsiToUnicodeAnsi U->ACP:%d->U %.*ls\n", Codepage, 01699 SourceLength > 10 ? 10 : SourceLength, Source)); 01700 #if defined(FE_SB) 01701 if (OEMCP == WINDOWSCP && Codepage == WINDOWSCP) 01702 return STATUS_SUCCESS; 01703 if (SourceLength == 0 ) 01704 return STATUS_SUCCESS; 01705 #endif 01706 NormalChars = TRUE; 01707 /* 01708 * Test for characters < 0x20 or >= 0x7F. If none are found, we don't have 01709 * any conversion to do! 01710 */ 01711 for (i=0;i<SourceLength;i++) { 01712 if ((USHORT)(Source[i] - 0x20) > 0x5e) { 01713 NormalChars = FALSE; 01714 break; 01715 } 01716 } 01717 if (NormalChars) { 01718 return STATUS_SUCCESS; 01719 } 01720 01721 TempLength = SourceLength; 01722 if (TempLength > STACK_BUFFER_SIZE) { 01723 Temp = (LPSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),TempLength); 01724 if (Temp == NULL) { 01725 return STATUS_NO_MEMORY; 01726 } 01727 } else { 01728 Temp = StackBuffer; 01729 } 01730 if (CONSOLE_IS_DBCS_ENABLED()) { 01731 Status = WideCharToMultiByte(USACP, 01732 0, 01733 Source, 01734 SourceLength, 01735 Temp, 01736 TempLength, 01737 NULL, 01738 NULL); 01739 } else { 01740 Status = RtlUnicodeToMultiByteN(Temp, 01741 TempLength, 01742 &Length, 01743 Source, 01744 SourceLength * sizeof(WCHAR) 01745 ); 01746 } 01747 01748 if (!NT_SUCCESS(Status)) { 01749 if (TempLength > STACK_BUFFER_SIZE) { 01750 ConsoleHeapFree(Temp); 01751 } 01752 return Status; 01753 } 01754 if (Codepage == OEMCP) { 01755 Status = RtlCustomCPToUnicodeN(&GlyphCP, 01756 Source, 01757 SourceLength * sizeof(WCHAR), 01758 &Length, 01759 Temp, 01760 TempLength 01761 ); 01762 } else { 01763 Status = MultiByteToWideChar(Codepage, 01764 MB_USEGLYPHCHARS, 01765 Temp, 01766 TempLength*sizeof(WCHAR), 01767 Source, 01768 SourceLength); 01769 } 01770 #if defined(FE_SB) 01771 if (SourceLength > STACK_BUFFER_SIZE) { 01772 ConsoleHeapFree(Temp); 01773 } 01774 #else 01775 if (TempLength > STACK_BUFFER_SIZE) { 01776 ConsoleHeapFree(Temp); 01777 } 01778 #endif 01779 if (!NT_SUCCESS(Status)) { 01780 return Status; 01781 } else { 01782 return STATUS_SUCCESS; 01783 } 01784 }

int FindCreateFont DWORD  Family,
LPWSTR  pwszTTFace,
COORD  Size,
LONG  Weight,
UINT  CodePage
 

Definition at line 650 of file w32/ntcon/server/misc.c.

References BOOL, BYTE, CodePageToCharSet(), CONSOLE_IS_DBCS_ENABLED, CREATED_BUT_NOT_FOUND, DBGFONTS, DefaultFaceName, DefaultFontIndex, DefaultFontSize, DoFontEnum(), _FONT_INFO::Family, FontInfo, GetAltFaceName(), IsAvailableFarEastCodePage(), IsAvailableTTFont(), L, MakeAltRasterFont(), NOT_CREATED_NOR_FOUND, NULL, NumberOfFonts, Size, _FONT_INFO::Size, SIZE_EQUAL, _FONT_INFO::SizeWant, TM_IS_TT_FONT, and _FONT_INFO::Weight.

Referenced by DoCreateScreenBuffer(), PropertiesUpdate(), SetFont(), and SrvCreateConsoleScreenBuffer().

00656 { 00657 #define NOT_CREATED_NOR_FOUND -1 00658 #define CREATED_BUT_NOT_FOUND -2 00659 00660 int i; 00661 int FontIndex = NOT_CREATED_NOR_FOUND; 00662 int BestMatch = NOT_CREATED_NOR_FOUND; 00663 BOOL bFontOK; 00664 WCHAR AltFaceName[LF_FACESIZE]; 00665 COORD AltFontSize; 00666 BYTE AltFontFamily; 00667 ULONG AltFontIndex = 0; 00668 LPWSTR pwszAltFace = NULL; 00669 00670 BYTE CharSet = CodePageToCharSet(CodePage); 00671 00672 DBGFONTS(("FindCreateFont Family=%x %ls (%d,%d) %d %d %x\n", 00673 Family, pwszFace, Size.X, Size.Y, Weight, CodePage, CharSet)); 00674 00675 if (CONSOLE_IS_DBCS_ENABLED() && 00676 !IS_ANY_DBCS_CHARSET(CharSet)) 00677 { 00678 MakeAltRasterFont(CodePage, FontInfo[DefaultFontIndex].Size, 00679 &AltFontSize, &AltFontFamily, &AltFontIndex, AltFaceName); 00680 00681 if (pwszFace == NULL || *pwszFace == L'\0') { 00682 pwszFace = AltFaceName; 00683 } 00684 if (Size.Y == 0) { 00685 Size.X = AltFontSize.X; 00686 Size.Y = AltFontSize.Y; 00687 } 00688 } 00689 else { 00690 if (pwszFace == NULL || *pwszFace == L'\0') { 00691 pwszFace = DefaultFaceName; 00692 } 00693 if (Size.Y == 0) { 00694 Size.X = DefaultFontSize.X; 00695 Size.Y = DefaultFontSize.Y; 00696 } 00697 } 00698 00699 if (IsAvailableTTFont(pwszFace)) { 00700 pwszAltFace = GetAltFaceName(pwszFace); 00701 } 00702 else { 00703 pwszAltFace = pwszFace; 00704 } 00705 00706 /* 00707 * Try to find the exact font 00708 */ 00709 TryFindExactFont: 00710 for (i=0; i < (int)NumberOfFonts; i++) { 00711 /* 00712 * If looking for a particular Family, skip non-matches 00713 */ 00714 if ((Family != 0) && 00715 ((BYTE)Family != FontInfo[i].Family)) { 00716 continue; 00717 } 00718 00719 /* 00720 * Skip non-matching sizes 00721 */ 00722 if ((FontInfo[i].SizeWant.Y != Size.Y) && 00723 !SIZE_EQUAL(FontInfo[i].Size, Size)) { 00724 continue; 00725 } 00726 00727 /* 00728 * Skip non-matching weights 00729 */ 00730 if ((Weight != 0) && (Weight != FontInfo[i].Weight)) { 00731 continue; 00732 } 00733 #if defined(FE_SB) 00734 if (!TM_IS_TT_FONT(FontInfo[i].Family) && 00735 FontInfo[i].tmCharSet != CharSet) { 00736 continue; 00737 } 00738 #endif 00739 00740 /* 00741 * Size (and maybe Family) match. 00742 * If we don't care about the name, or if it matches, use this font. 00743 * Else if name doesn't match and it is a raster font, consider it. 00744 */ 00745 if ((pwszFace == NULL) || (pwszFace[0] == L'\0') || 00746 wcscmp(FontInfo[i].FaceName, pwszFace) == 0 || 00747 wcscmp(FontInfo[i].FaceName, pwszAltFace) == 0 00748 ) { 00749 FontIndex = i; 00750 goto FoundFont; 00751 } else if (!TM_IS_TT_FONT(FontInfo[i].Family)) { 00752 BestMatch = i; 00753 } 00754 } 00755 00756 /* 00757 * Didn't find the exact font, so try to create it 00758 */ 00759 if (FontIndex == NOT_CREATED_NOR_FOUND) { 00760 ULONG ulOldEnumFilter; 00761 ulOldEnumFilter = SetFontEnumeration(0); 00762 // restore all the other flags 00763 SetFontEnumeration(ulOldEnumFilter & ~FE_FILTER_TRUETYPE); 00764 if (Size.Y < 0) { 00765 Size.Y = -Size.Y; 00766 } 00767 bFontOK = DoFontEnum(NULL, pwszFace, Size.Y); 00768 SetFontEnumeration(ulOldEnumFilter); 00769 if (bFontOK) { 00770 DBGFONTS(("FindCreateFont created font!\n")); 00771 FontIndex = CREATED_BUT_NOT_FOUND; 00772 goto TryFindExactFont; 00773 } else { 00774 DBGFONTS(("FindCreateFont failed to create font!\n")); 00775 } 00776 } 00777 00778 /* 00779 * Failed to find exact match, but we have a close Raster Font 00780 * fit - only the name doesn't match. 00781 */ 00782 if (BestMatch >= 0) { 00783 FontIndex = BestMatch; 00784 goto FoundFont; 00785 } 00786 00787 /* 00788 * Failed to find exact match, even after enumeration, so now try 00789 * to find a font of same family and same size or bigger 00790 */ 00791 for (i=0; i < (int)NumberOfFonts; i++) { 00792 #if defined(FE_SB) 00793 if (CONSOLE_IS_DBCS_ENABLED()) { 00794 if ((Family != 0) && 00795 ((BYTE)Family != FontInfo[i].Family)) { 00796 continue; 00797 } 00798 00799 if (!TM_IS_TT_FONT(FontInfo[i].Family) && 00800 FontInfo[i].tmCharSet != CharSet) { 00801 continue; 00802 } 00803 } 00804 else { 00805 #endif 00806 if ((BYTE)Family != FontInfo[i].Family) { 00807 continue; 00808 } 00809 #if defined(FE_SB) 00810 } 00811 #endif 00812 00813 if (FontInfo[i].Size.Y >= Size.Y && 00814 FontInfo[i].Size.X >= Size.X) { 00815 // Same family, size >= desired. 00816 FontIndex = i; 00817 break; 00818 } 00819 } 00820 00821 if (FontIndex < 0) { 00822 DBGFONTS(("FindCreateFont defaults!\n")); 00823 #if defined(FE_SB) 00824 if (CONSOLE_IS_DBCS_ENABLED() && 00825 !IsAvailableFarEastCodePage(CodePage)) 00826 { 00827 FontIndex = AltFontIndex; 00828 } 00829 else 00830 #endif 00831 FontIndex = DefaultFontIndex; 00832 } 00833 00834 FoundFont: 00835 DBGFONTS(("FindCreateFont returns %x : %ls (%d,%d)\n", FontIndex, 00836 FontInfo[FontIndex].FaceName, 00837 FontInfo[FontIndex].Size.X, FontInfo[FontIndex].Size.Y)); 00838 return FontIndex; 00839 00840 #undef NOT_CREATED_NOR_FOUND 00841 #undef CREATED_BUT_NOT_FOUND 00842 }

NTSTATUS FindTextBufferFontInfo IN PSCREEN_INFORMATION  ScreenInfo,
IN UINT  CodePage,
OUT PTEXT_BUFFER_FONT_INFO  TextFontInfo
 

Definition at line 846 of file w32/ntcon/server/misc.c.

References _TEXT_BUFFER_FONT_INFO::FontCodePage, _TEXT_BUFFER_FONT_INFO::NextTextBufferFont, and NULL.

00854 : 00855 00856 This routine find a font information which correspond to code page value. 00857 00858 Arguments: 00859 00860 Return Value: 00861 00862 --*/ 00863 00864 { 00865 PTEXT_BUFFER_FONT_INFO CurrentFont; 00866 00867 CurrentFont = ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont; 00868 00869 while (CurrentFont != NULL) { 00870 if (CurrentFont->FontCodePage == CodePage) { 00871 *TextFontInfo = *CurrentFont; 00872 return STATUS_SUCCESS; 00873 } 00874 CurrentFont = CurrentFont->NextTextBufferFont; 00875 } 00876 00877 return STATUS_UNSUCCESSFUL; 00878 }

NTSTATUS FlushAllButKeys PINPUT_INFORMATION  InputInformation  ) 
 

Definition at line 401 of file ntcon/server/input.c.

References BOOL, BufferSize, ConsoleHeapAlloc, ConsoleHeapFree, FALSE, _INPUT_INFORMATION::In, _INPUT_INFORMATION::InputBuffer, _INPUT_INFORMATION::InputBufferSize, _INPUT_INFORMATION::InputWaitEvent, MAKE_TAG, NT_SUCCESS, NtClearEvent(), NTSTATUS(), NULL, _INPUT_INFORMATION::Out, ReadBuffer(), Status, TMP_TAG, and TRUE.

Referenced by SetActiveScreenBuffer().

00407 : 00408 00409 This routine removes all but the key events from the buffer. 00410 00411 Arguments: 00412 00413 InputInformation - Pointer to input buffer information structure. 00414 00415 Return Value: 00416 00417 Note: 00418 00419 The console lock must be held when calling this routine. 00420 00421 --*/ 00422 00423 { 00424 ULONG NumberOfEventsRead,i; 00425 NTSTATUS Status; 00426 PINPUT_RECORD TmpInputBuffer,InPtr,TmpInputBufferPtr; 00427 ULONG BufferSize; 00428 BOOL Dummy; 00429 00430 if (InputInformation->In != InputInformation->Out) { 00431 00432 // 00433 // allocate memory for temp buffer 00434 // 00435 00436 BufferSize = sizeof(INPUT_RECORD) * (InputInformation->InputBufferSize+1); 00437 TmpInputBuffer = (PINPUT_RECORD)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),BufferSize); 00438 if (TmpInputBuffer == NULL) { 00439 return STATUS_NO_MEMORY; 00440 } 00441 TmpInputBufferPtr = TmpInputBuffer; 00442 00443 // 00444 // copy input buffer. 00445 // let ReadBuffer do any compaction work. 00446 // 00447 00448 Status = ReadBuffer(InputInformation, 00449 TmpInputBuffer, 00450 InputInformation->InputBufferSize, 00451 &NumberOfEventsRead, 00452 TRUE, 00453 FALSE, 00454 &Dummy 00455 #if defined(FE_SB) 00456 , 00457 TRUE 00458 #endif 00459 ); 00460 00461 if (!NT_SUCCESS(Status)) { 00462 ConsoleHeapFree(TmpInputBuffer); 00463 return Status; 00464 } 00465 00466 InputInformation->Out = (ULONG_PTR) InputInformation->InputBuffer; 00467 InPtr = InputInformation->InputBuffer; 00468 for (i=0;i<NumberOfEventsRead;i++) { 00469 if (TmpInputBuffer->EventType == KEY_EVENT) { 00470 *InPtr = *TmpInputBuffer; 00471 InPtr++; 00472 } 00473 TmpInputBuffer++; 00474 } 00475 InputInformation->In = (ULONG_PTR) InPtr; 00476 if (InputInformation->In == InputInformation->Out) { 00477 NtClearEvent(InputInformation->InputWaitEvent); 00478 } 00479 ConsoleHeapFree(TmpInputBufferPtr); 00480 } 00481 return STATUS_SUCCESS; 00482 }

NTSTATUS FlushInputBuffer IN PINPUT_INFORMATION  InputInformation  ) 
 

VOID FreeAliasBuffers IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 591 of file server/cmdline.c.

References FreeAliasList().

Referenced by AbortCreateConsole(), and DestroyWindowsWindow().

00594 { 00595 PEXE_ALIAS_LIST AliasList; 00596 PLIST_ENTRY ListHead, ListNext; 00597 00598 ListHead = &Console->ExeAliasList; 00599 ListNext = ListHead->Flink; 00600 while (ListNext != ListHead) { 00601 AliasList = CONTAINING_RECORD( ListNext, EXE_ALIAS_LIST, ListLink ); 00602 ListNext = ListNext->Flink; 00603 FreeAliasList(AliasList); 00604 } 00605 }

VOID FreeCommandHistory IN PCONSOLE_INFORMATION  Console,
IN HANDLE  ProcessHandle
 

Definition at line 4605 of file server/cmdline.c.

References CLE_ALLOCATED, FindCommandHistory(), History, and NULL.

Referenced by RemoveConsole().

04612 : 04613 04614 This routine marks the command history buffer freed. 04615 04616 Arguments: 04617 04618 Console - pointer to console. 04619 04620 ProcessHandle - handle to client process. 04621 04622 Return Value: 04623 04624 none. 04625 04626 --*/ 04627 04628 { 04629 PCOMMAND_HISTORY History; 04630 04631 History = FindCommandHistory(Console,ProcessHandle); 04632 if (History) { 04633 History->Flags &= ~CLE_ALLOCATED; 04634 History->ProcessHandle = NULL; 04635 } 04636 }

VOID FreeCommandHistoryBuffers IN OUT PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 4640 of file server/cmdline.c.

References ConsoleHeapFree, History, and SHORT.

Referenced by AbortCreateConsole(), and DestroyWindowsWindow().

04643 { 04644 PCOMMAND_HISTORY History; 04645 PLIST_ENTRY ListHead, ListNext; 04646 SHORT i; 04647 04648 ListHead = &Console->CommandHistoryList; 04649 ListNext = ListHead->Flink; 04650 while (ListNext != ListHead) { 04651 History = CONTAINING_RECORD( ListNext, COMMAND_HISTORY, ListLink ); 04652 ListNext = ListNext->Flink; 04653 RemoveEntryList(&History->ListLink); 04654 if (History->AppName) { 04655 ConsoleHeapFree(History->AppName); 04656 } 04657 for (i=0;i<History->NumberOfCommands;i++) { 04658 ConsoleHeapFree(History->Commands[i]); 04659 } 04660 ConsoleHeapFree(History); 04661 } 04662 }

VOID FreeCon IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 1110 of file w32/ntcon/server/handle.c.

References AbortCreateConsole(), CM_DESTROY_WINDOW, CONSOLE_TERMINATING, hWnd, NtSetEvent(), NULL, SendMessageTimeout(), and UnlockConsole().

Referenced by RemoveConsole().

01116 : 01117 01118 This routine frees a console and its associated 01119 data - input buffer and screen buffer. 01120 01121 Arguments: 01122 01123 ConsoleHandle - Handle of console to free. 01124 01125 Return Value: 01126 01127 Note: 01128 01129 The console handle table lock must be held when calling this routine. 01130 01131 --*/ 01132 01133 { 01134 HWND hWnd; 01135 01136 Console->Flags |= CONSOLE_TERMINATING; 01137 NtSetEvent(Console->TerminationEvent,NULL); 01138 hWnd = Console->hWnd; 01139 01140 // 01141 // Wait 10 seconds or until the input thread replies 01142 // to synchronize the window destruction with 01143 // the termination of the thread 01144 // 01145 01146 if (hWnd != NULL) { 01147 UnlockConsole(Console); 01148 SendMessageTimeout(hWnd, CM_DESTROY_WINDOW, 0, 0, SMTO_BLOCK, 10000, NULL); 01149 } else { 01150 AbortCreateConsole(Console); 01151 } 01152 }

NTSTATUS FreeConsoleHandle IN HANDLE  Handle  ) 
 

Definition at line 331 of file w32/ntcon/server/handle.c.

References ASSERT, ConsoleHandles, ConsoleHandleTableLocked, FALSE, Handle, IndexFromHandle, NULL, and NumberOfConsoleHandles.

Referenced by DestroyConsole(), and SetUpConsole().

00337 : 00338 00339 This routine frees a console handle from the global table. 00340 00341 Arguments: 00342 00343 Handle - Handle to free. 00344 00345 Return Value: 00346 00347 Note: 00348 00349 The console handle table lock must be held when calling this routine. 00350 00351 --*/ 00352 00353 { 00354 ULONG i; 00355 00356 ASSERT(ConsoleHandleTableLocked()); 00357 00358 ASSERT (Handle != NULL); 00359 i = IndexFromHandle(Handle); 00360 if ((i >= NumberOfConsoleHandles) || (ConsoleHandles[i] == NULL)) { 00361 ASSERT (FALSE); 00362 } else { 00363 ConsoleHandles[i] = NULL; 00364 } 00365 return STATUS_SUCCESS; 00366 }

VOID FreeInputBuffer IN PINPUT_INFORMATION  InputBufferInformation  ) 
 

Definition at line 221 of file ntcon/server/input.c.

References ASSERT, and ConsoleHeapFree.

Referenced by AbortCreateConsole(), AllocateConsole(), and DestroyWindowsWindow().

00227 : 00228 00229 This routine frees the resources associated with an input buffer. 00230 00231 Arguments: 00232 00233 InputBufferInformation - Pointer to input buffer information structure. 00234 00235 Return Value: 00236 00237 00238 --*/ 00239 00240 { 00241 ASSERT(InputBufferInformation->RefCount == 0); 00242 CloseHandle(InputBufferInformation->InputWaitEvent); 00243 ConsoleHeapFree(InputBufferInformation->InputBuffer); 00244 }

NTSTATUS FreeIoHandle IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN HANDLE  Handle
 

Definition at line 1455 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_FREE_HANDLE, CONSOLE_INPUT_HANDLE, DereferenceIoHandleNoCheck(), FreeInputHandle(), Handle, _HANDLE_DATA::HandleType, NT_SUCCESS, NTSTATUS(), and Status.

Referenced by CloseInputHandle(), CloseOutputHandle(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), and SrvOpenConsole().

01462 : 01463 01464 This routine frees an input or output handle from the process's 01465 handle table. 01466 01467 Arguments: 01468 01469 ProcessData - Pointer to per process data structure. 01470 01471 Handle - Handle to free. 01472 01473 Return Value: 01474 01475 Note: 01476 01477 The console lock must be held when calling this routine. The handle 01478 is freed from the per-process handle table. Holding the console 01479 lock serializes both threads within the calling process and any other 01480 process that shares the console. 01481 01482 --*/ 01483 01484 { 01485 NTSTATUS Status; 01486 PHANDLE_DATA HandleData; 01487 01488 Status = DereferenceIoHandleNoCheck(ProcessData, 01489 Handle, 01490 &HandleData 01491 ); 01492 ASSERT (NT_SUCCESS(Status)); 01493 if (HandleData->HandleType & CONSOLE_INPUT_HANDLE) { 01494 FreeInputHandle(HandleData); 01495 } 01496 HandleData->HandleType = CONSOLE_FREE_HANDLE; 01497 return STATUS_SUCCESS; 01498 }

VOID FreeProcessData IN PCONSOLE_PER_PROCESS_DATA  ProcessData  ) 
 

Definition at line 1280 of file w32/ntcon/server/handle.c.

References CONSOLE_INITIAL_IO_HANDLES, and ConsoleHeapFree.

Referenced by RemoveConsole().

01286 : 01287 01288 This routine frees any per-process data allocated by the console. 01289 01290 Arguments: 01291 01292 ProcessData - Pointer to the per-process data structure. 01293 01294 Return Value: 01295 01296 --*/ 01297 01298 { 01299 if (ProcessData->HandleTableSize != CONSOLE_INITIAL_IO_HANDLES) { 01300 ConsoleHeapFree(ProcessData->HandleTablePtr); 01301 ProcessData->HandleTablePtr = ProcessData->HandleTable; 01302 ProcessData->HandleTableSize = CONSOLE_INITIAL_IO_HANDLES; 01303 } 01304 }

NTSTATUS FreeScreenBuffer IN PSCREEN_INFORMATION  ScreenInformation  ) 
 

Definition at line 1021 of file output.c.

References ASSERT, CONSOLE_TEXTMODE_BUFFER, ConsoleHeapFree, DeleteDbcsScreenBuffer(), FALSE, FreeConsoleBitmap(), _CONSOLE_INFORMATION::hDC, _CONSOLE_INFORMATION::hSysPalette, NULL, RemoveTextBufferFontInfo(), SelectPalette, and SHORT.

Referenced by AllocateConsole(), CloseOutputHandle(), DestroyWindowsWindow(), and SrvCreateConsoleScreenBuffer().

01027 : 01028 01029 This routine frees the memory associated with a screen buffer. 01030 01031 Arguments: 01032 01033 ScreenInfo - screen buffer data to free. 01034 01035 Return Value: 01036 01037 Note: console handle table lock must be held when calling this routine 01038 01039 --*/ 01040 01041 { 01042 SHORT i; 01043 PCONSOLE_INFORMATION Console = ScreenInfo->Console; 01044 01045 ASSERT(ScreenInfo->RefCount == 0); 01046 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 01047 for (i=0;i<ScreenInfo->ScreenBufferSize.Y;i++) { 01048 if (ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length > 1) { 01049 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs); 01050 } 01051 } 01052 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.TextRows); 01053 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.Rows); 01054 #if defined(FE_SB) 01055 DeleteDbcsScreenBuffer(&ScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer); 01056 #endif 01057 RemoveTextBufferFontInfo(ScreenInfo); 01058 } else { 01059 if (ScreenInfo->hPalette != NULL) { 01060 if (GetCurrentObject(Console->hDC, OBJ_PAL) == ScreenInfo->hPalette) { 01061 SelectPalette(Console->hDC, Console->hSysPalette, FALSE); 01062 } 01063 DeleteObject(ScreenInfo->hPalette); 01064 } 01065 FreeConsoleBitmap(ScreenInfo); 01066 } 01067 ConsoleHeapFree(ScreenInfo); 01068 return STATUS_SUCCESS; 01069 }

NTSTATUS GetAvailableFonts IN PSCREEN_INFORMATION  ScreenInfo,
IN BOOLEAN  MaximumWindow,
OUT PVOID  Buffer,
IN OUT PULONG  NumFonts
 

Definition at line 998 of file w32/ntcon/server/misc.c.

References Buffer, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, FontInfo, GetWindowLimits(), _WINDOW_LIMITS::MaximumWindowSize, NumberOfFonts, SCR_FONTSIZE(), SHORT, and _FONT_INFO::Size.

Referenced by SrvGetConsoleFontInfo().

01004 { 01005 PCONSOLE_FONT_INFO BufPtr; 01006 ULONG i; 01007 COORD WindowSize; 01008 WINDOW_LIMITS WindowLimits; 01009 01010 // 01011 // if the buffer is too small to return all the fonts, return 01012 // the number that will fit. 01013 // 01014 01015 *NumFonts = (*NumFonts > NumberOfFonts) ? NumberOfFonts : *NumFonts; 01016 01017 // 01018 // convert font size in pixels to font size in rows/columns 01019 // 01020 01021 BufPtr = (PCONSOLE_FONT_INFO)Buffer; 01022 01023 if (MaximumWindow) { 01024 GetWindowLimits(ScreenInfo, &WindowLimits); 01025 WindowSize = WindowLimits.MaximumWindowSize; 01026 } 01027 else { 01028 WindowSize.X = (SHORT)CONSOLE_WINDOW_SIZE_X(ScreenInfo); 01029 WindowSize.Y = (SHORT)CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 01030 } 01031 for (i=0;i<*NumFonts;i++,BufPtr++) { 01032 BufPtr->nFont = i; 01033 BufPtr->dwFontSize.X = WindowSize.X * SCR_FONTSIZE(ScreenInfo).X / FontInfo[i].Size.X; 01034 BufPtr->dwFontSize.Y = WindowSize.Y * SCR_FONTSIZE(ScreenInfo).Y / FontInfo[i].Size.Y; 01035 } 01036 01037 return STATUS_SUCCESS; 01038 }

NTSTATUS GetConsoleLangId IN UINT  OutputCP,
OUT LANGID *  pLangId
 

Definition at line 2643 of file srvinit.c.

References CONSOLE_IS_DBCS_ENABLED, NTSTATUS(), NULL, and Status.

Referenced by CommandNumberPopup(), CopyFromCharPopup(), CopyToCharPopup(), SetTEBLangID(), and SrvGetConsoleLangId().

02647 { 02648 NTSTATUS Status; 02649 02650 if (CONSOLE_IS_DBCS_ENABLED()){ 02651 if (pLangId != NULL) { 02652 switch (OutputCP) { 02653 case 932: 02654 *pLangId = MAKELANGID( LANG_JAPANESE, SUBLANG_DEFAULT ); 02655 break; 02656 case 949: 02657 *pLangId = MAKELANGID( LANG_KOREAN, SUBLANG_KOREAN ); 02658 break; 02659 case 936: 02660 *pLangId = MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED ); 02661 break; 02662 case 950: 02663 *pLangId = MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL ); 02664 break; 02665 default: 02666 *pLangId = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); 02667 break; 02668 } 02669 } 02670 Status = STATUS_SUCCESS; 02671 } 02672 else { 02673 Status = STATUS_NOT_SUPPORTED; 02674 } 02675 02676 return Status; 02677 }

NTSTATUS GetCurrentFont IN PSCREEN_INFORMATION  ScreenInfo,
IN BOOLEAN  MaximumWindow,
OUT PULONG  FontIndex,
OUT PCOORD  FontSize
 

Definition at line 1053 of file w32/ntcon/server/misc.c.

References CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, GetWindowLimits(), _WINDOW_LIMITS::MaximumWindowSize, SCR_FONTNUMBER(), and SHORT.

Referenced by SrvGetConsoleCurrentFont().

01059 { 01060 COORD WindowSize; 01061 WINDOW_LIMITS WindowLimits; 01062 01063 if (MaximumWindow) { 01064 GetWindowLimits(ScreenInfo, &WindowLimits); 01065 WindowSize = WindowLimits.MaximumWindowSize; 01066 } 01067 else { 01068 WindowSize.X = (SHORT)CONSOLE_WINDOW_SIZE_X(ScreenInfo); 01069 WindowSize.Y = (SHORT)CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 01070 } 01071 *FontIndex = SCR_FONTNUMBER(ScreenInfo); 01072 *FontSize = WindowSize; 01073 return STATUS_SUCCESS; 01074 }

NTSTATUS GetFontSize IN DWORD  FontIndex,
OUT PCOORD  FontSize
 

Definition at line 1041 of file w32/ntcon/server/misc.c.

References FontInfo, NumberOfFonts, and _FONT_INFO::Size.

Referenced by SetScreenBufferFont(), and SrvGetConsoleFontSize().

01045 { 01046 if (FontIndex >= NumberOfFonts) 01047 return STATUS_INVALID_PARAMETER; 01048 *FontSize = FontInfo[FontIndex].Size; 01049 return STATUS_SUCCESS; 01050 }

DWORD GetLinkProperties LPWSTR  pszLinkName,
LPVOID  lpvBuffer,
UINT  cb
 

Definition at line 264 of file link.c.

References ASSERT, ConsoleHeapFree, DWORD, INT, LINK_FULLINFO, LINK_NOINFO, LINK_SIMPLEINFO, LoadLink(), and LPLNKPROPNTCONSOLE.

Referenced by LoadLinkInfo().

00265 { 00266 CShellLink mld; 00267 DWORD fResult; 00268 LPNT_CONSOLE_PROPS lpExtraData; 00269 DWORD dwSize = 0; 00270 00271 /* 00272 { 00273 TCHAR szRick[ 1024 ]; 00274 STARTUPINFO si; 00275 PROCESS_INFORMATION pi; 00276 00277 // HUGE, HUGE hack-o-rama to get NTSD started on this process! 00278 wsprintf( szRick, TEXT("ntsd -d -p %d"), GetCurrentProcessId() ); 00279 GetStartupInfo( &si ); 00280 CreateProcess( NULL, szRick, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ); 00281 CloseHandle( pi.hProcess ); 00282 CloseHandle( pi.hThread ); 00283 Sleep( 5*1000 ); 00284 DebugBreak(); 00285 00286 } 00287 */ 00288 00289 00290 00291 // Zero out structure on the stack 00292 RtlZeroMemory( &mld, sizeof(mld) ); 00293 00294 // Load link data 00295 if (!LoadLink( pszLinkName, &mld )) { 00296 RIPMSG1(RIP_WARNING, "LoadLink %ws failed", pszLinkName); 00297 fResult = LINK_NOINFO; 00298 goto Cleanup; 00299 } 00300 00301 // Check return buffer -- is it big enough? 00302 ASSERT(cb >= sizeof( LNKPROPNTCONSOLE)); 00303 00304 // Zero out callers buffer 00305 RtlZeroMemory( lpvBuffer, cb ); 00306 00307 // Copy relevant shell link data into caller's buffer 00308 if (mld.pszName) 00309 lstrcpy( ((LPLNKPROPNTCONSOLE)lpvBuffer)->pszName, mld.pszName ); 00310 if (mld.pszIconLocation) 00311 lstrcpy( ((LPLNKPROPNTCONSOLE)lpvBuffer)->pszIconLocation, mld.pszIconLocation ); 00312 ((LPLNKPROPNTCONSOLE)lpvBuffer)->uIcon = mld.sld.iIcon; 00313 ((LPLNKPROPNTCONSOLE)lpvBuffer)->uShowCmd = mld.sld.iShowCmd; 00314 ((LPLNKPROPNTCONSOLE)lpvBuffer)->uHotKey = mld.sld.wHotkey; 00315 fResult = LINK_SIMPLEINFO; 00316 00317 // Find console properties in extra data section 00318 for( lpExtraData = (LPNT_CONSOLE_PROPS)mld.pExtraData; 00319 lpExtraData && lpExtraData->cbSize; 00320 (LPBYTE)lpExtraData += dwSize 00321 ) 00322 { 00323 dwSize = lpExtraData->cbSize; 00324 if (dwSize) 00325 { 00326 if (lpExtraData->dwSignature == NT_CONSOLE_PROPS_SIG) 00327 { 00328 00329 RtlCopyMemory( &((LPLNKPROPNTCONSOLE)lpvBuffer)->console_props, 00330 lpExtraData, 00331 sizeof( NT_CONSOLE_PROPS ) 00332 ); 00333 fResult = LINK_FULLINFO; 00334 #if !defined(FE_SB) 00335 break; 00336 #endif 00337 } 00338 #if defined(FE_SB) 00339 if (lpExtraData->dwSignature == NT_FE_CONSOLE_PROPS_SIG) 00340 { 00341 LPNT_FE_CONSOLE_PROPS lpFEExtraData = (LPNT_FE_CONSOLE_PROPS)lpExtraData; 00342 00343 RtlCopyMemory( &((LPLNKPROPNTCONSOLE)lpvBuffer)->fe_console_props, 00344 lpFEExtraData, 00345 sizeof( NT_FE_CONSOLE_PROPS ) 00346 ); 00347 } 00348 #endif 00349 } 00350 } 00351 00352 #if 0 00353 #define ConsoleInfo ((LPLNKPROPNTCONSOLE)lpvBuffer) 00354 { 00355 TCHAR szTemp[ 256 ]; 00356 INT i; 00357 00358 wsprintf( szTemp, TEXT("[GetLinkProperties -- Link Properties for %s]\n"), pszLinkName ); 00359 OutputDebugString( szTemp ); 00360 wsprintf( szTemp, TEXT(" wFillAttribute = 0x%04X\n"), ConsoleInfo->console_props.wFillAttribute ); 00361 OutputDebugString( szTemp ); 00362 wsprintf( szTemp, TEXT(" wPopupFillAttribute = 0x%04X\n"), ConsoleInfo->console_props.wPopupFillAttribute ); 00363 OutputDebugString( szTemp ); 00364 wsprintf( szTemp, TEXT(" dwScreenBufferSize = (%d , %d)\n"), ConsoleInfo->console_props.dwScreenBufferSize.X, ConsoleInfo->console_props.dwScreenBufferSize.Y ); 00365 OutputDebugString( szTemp ); 00366 wsprintf( szTemp, TEXT(" dwWindowSize = (%d , %d)\n"), ConsoleInfo->console_props.dwWindowSize.X, ConsoleInfo->console_props.dwWindowSize.Y ); 00367 OutputDebugString( szTemp ); 00368 wsprintf( szTemp, TEXT(" dwWindowOrigin = (%d , %d)\n"), ConsoleInfo->console_props.dwWindowOrigin.X, ConsoleInfo->console_props.dwWindowOrigin.Y ); 00369 OutputDebugString( szTemp ); 00370 wsprintf( szTemp, TEXT(" nFont = 0x%X\n"), ConsoleInfo->console_props.nFont ); 00371 OutputDebugString( szTemp ); 00372 wsprintf( szTemp, TEXT(" nInputBufferSize = 0x%X\n"), ConsoleInfo->console_props.nInputBufferSize ); 00373 OutputDebugString( szTemp ); 00374 wsprintf( szTemp, TEXT(" dwFontSize = (%d , %d)\n"), ConsoleInfo->console_props.dwFontSize.X, ConsoleInfo->console_props.dwFontSize.Y ); 00375 OutputDebugString( szTemp ); 00376 wsprintf( szTemp, TEXT(" uFontFamily = 0x%08X\n"), ConsoleInfo->console_props.uFontFamily ); 00377 OutputDebugString( szTemp ); 00378 wsprintf( szTemp, TEXT(" uFontWeight = 0x%08X\n"), ConsoleInfo->console_props.uFontWeight ); 00379 OutputDebugString( szTemp ); 00380 wsprintf( szTemp, TEXT(" FaceName = %ws\n"), ConsoleInfo->console_props.FaceName ); 00381 OutputDebugString( szTemp ); 00382 wsprintf( szTemp, TEXT(" uCursorSize = %d\n"), ConsoleInfo->console_props.uCursorSize ); 00383 OutputDebugString( szTemp ); 00384 wsprintf( szTemp, TEXT(" bFullScreen = %s\n"), ConsoleInfo->console_props.bFullScreen ? TEXT("TRUE") : TEXT("FALSE") ); 00385 OutputDebugString( szTemp ); 00386 wsprintf( szTemp, TEXT(" bQuickEdit = %s\n"), ConsoleInfo->console_props.bQuickEdit ? TEXT("TRUE") : TEXT("FALSE") ); 00387 OutputDebugString( szTemp ); 00388 wsprintf( szTemp, TEXT(" bInsertMode = %s\n"), ConsoleInfo->console_props.bInsertMode ? TEXT("TRUE") : TEXT("FALSE") ); 00389 OutputDebugString( szTemp ); 00390 wsprintf( szTemp, TEXT(" bAutoPosition = %s\n"), ConsoleInfo->console_props.bAutoPosition ? TEXT("TRUE") : TEXT("FALSE") ); 00391 OutputDebugString( szTemp ); 00392 wsprintf( szTemp, TEXT(" uHistoryBufferSize = %d\n"), ConsoleInfo->console_props.uHistoryBufferSize ); 00393 OutputDebugString( szTemp ); 00394 wsprintf( szTemp, TEXT(" uNumHistoryBuffers = %d\n"), ConsoleInfo->console_props.uNumberOfHistoryBuffers ); 00395 OutputDebugString( szTemp ); 00396 wsprintf( szTemp, TEXT(" bHistoryNoDup = %s\n"), ConsoleInfo->console_props.bHistoryNoDup ? TEXT("TRUE") : TEXT("FALSE") ); 00397 OutputDebugString( szTemp ); 00398 OutputDebugString( TEXT(" ColorTable = [") ); 00399 i=0; 00400 while( i < 16 ) 00401 { 00402 OutputDebugString( TEXT("\n ") ); 00403 wsprintf( szTemp, TEXT("0x%08X "), ConsoleInfo->console_props.ColorTable[i++]); 00404 OutputDebugString( szTemp ); 00405 wsprintf( szTemp, TEXT("0x%08X "), ConsoleInfo->console_props.ColorTable[i++]); 00406 OutputDebugString( szTemp ); 00407 wsprintf( szTemp, TEXT("0x%08X "), ConsoleInfo->console_props.ColorTable[i++]); 00408 OutputDebugString( szTemp ); 00409 wsprintf( szTemp, TEXT("0x%08X "), ConsoleInfo->console_props.ColorTable[i++]); 00410 OutputDebugString( szTemp ); 00411 } 00412 OutputDebugString( TEXT("]\n\n") ); 00413 } 00414 #undef ConsoleInfo 00415 #endif 00416 00417 Cleanup: 00418 if (mld.pszName) 00419 ConsoleHeapFree( mld.pszName ); 00420 if (mld.pszRelPath) 00421 ConsoleHeapFree( mld.pszRelPath ); 00422 if (mld.pszWorkingDir) 00423 ConsoleHeapFree( mld.pszWorkingDir ); 00424 if (mld.pszArgs) 00425 ConsoleHeapFree( mld.pszArgs ); 00426 if (mld.pszIconLocation) 00427 ConsoleHeapFree( mld.pszIconLocation ); 00428 if (mld.pExtraData) 00429 ConsoleHeapFree( mld.pExtraData ); 00430 00431 return fResult; 00432 00433 }

NTSTATUS GetMouseButtons PULONG  NumButtons  ) 
 

Definition at line 66 of file w32/ntcon/server/misc.c.

References NumberOfMouseButtons.

Referenced by SrvGetConsoleMouseInfo().

00069 { 00070 *NumButtons = NumberOfMouseButtons; 00071 return STATUS_SUCCESS; 00072 }

NTSTATUS GetNumberOfReadyEvents IN PINPUT_INFORMATION  InputInformation,
OUT PULONG  NumberOfEvents
 

Definition at line 362 of file ntcon/server/input.c.

Referenced by PrependInputBuffer(), and SrvGetConsoleNumberOfInputEvents().

00369 : 00370 00371 This routine returns the number of events in the input buffer. 00372 00373 Arguments: 00374 00375 InputInformation - Pointer to input buffer information structure. 00376 00377 NumberOfEvents - On output contains the number of events. 00378 00379 Return Value: 00380 00381 Note: 00382 00383 The console lock must be held when calling this routine. 00384 00385 --*/ 00386 00387 { 00388 if (InputInformation->In < InputInformation->Out) { 00389 *NumberOfEvents = (ULONG)(InputInformation->Last - InputInformation->Out); 00390 *NumberOfEvents += (ULONG)(InputInformation->In - InputInformation->First); 00391 } 00392 else { 00393 *NumberOfEvents = (ULONG)(InputInformation->In - InputInformation->Out); 00394 } 00395 *NumberOfEvents /= sizeof(INPUT_RECORD); 00396 00397 return STATUS_SUCCESS; 00398 }

NTSTATUS GetNumFonts OUT PULONG  NumberOfFonts  ) 
 

Definition at line 988 of file w32/ntcon/server/misc.c.

References NumberOfFonts.

Referenced by SrvGetConsoleNumberOfFonts().

00991 { 00992 *NumFonts = NumberOfFonts; 00993 return STATUS_SUCCESS; 00994 }

VOID GetRegistryValues IN LPWSTR  ConsoleTitle,
OUT PCONSOLE_REGISTRY_INFO  RegInfo
 

Definition at line 2210 of file srvinit.c.

References ConsoleHeapFree, DbgPrint, DBGPRINT, DefaultRegInfo, DWORD, FALSE, gaWordDelimChars, gaWordDelimCharsDefault, gExtendedEditKey, gfLoadConIme, gfTrimLeadingZeros, InitExtendedEditKeys(), IsAvailableFarEastCodePage(), L, _CONSOLE_REGISTRY_INFO::LastWriteTime, MyRegOpenKey(), MyRegQueryValue(), NELEM, NT_ERROR, NT_SUCCESS, NtClose(), NtQueryKey(), NTSTATUS(), NULL, OEMCP, PBYTE, RtlOpenCurrentUser(), Status, TranslateConsoleTitle(), TRUE, UINT, and WORD_DELIM_MAX.

Referenced by InitWindowsStuff(), and LoadLinkInfo().

02217 : 02218 02219 This routine reads in values from the registry and places them 02220 in the supplied structure. 02221 02222 Arguments: 02223 02224 ConsoleTitle - name of subkey to open 02225 02226 RegInfo - pointer to structure to receive information 02227 02228 Return Value: 02229 02230 none 02231 02232 --*/ 02233 02234 { 02235 HANDLE hCurrentUserKey; 02236 HANDLE hConsoleKey; 02237 HANDLE hTitleKey; 02238 NTSTATUS Status; 02239 LPWSTR TranslatedConsoleTitle; 02240 DWORD dwValue; 02241 DWORD i; 02242 WCHAR awchFaceName[LF_FACESIZE]; 02243 WCHAR awchBuffer[64]; 02244 KEY_BASIC_INFORMATION KeyInfo; 02245 ULONG ResultLength; 02246 02247 // 02248 // Impersonate the client process 02249 // 02250 02251 if (!CsrImpersonateClient(NULL)) { 02252 KdPrint(("CONSRV: GetRegistryValues Impersonate failed\n")); 02253 return; 02254 } 02255 02256 // 02257 // Open the current user registry key 02258 // 02259 02260 Status = RtlOpenCurrentUser(MAXIMUM_ALLOWED, &hCurrentUserKey); 02261 if (!NT_SUCCESS(Status)) { 02262 CsrRevertToSelf(); 02263 return; 02264 } 02265 02266 // 02267 // Open the console registry key 02268 // 02269 02270 Status = MyRegOpenKey(hCurrentUserKey, 02271 CONSOLE_REGISTRY_STRING, 02272 &hConsoleKey); 02273 if (!NT_SUCCESS(Status)) { 02274 NtClose(hCurrentUserKey); 02275 CsrRevertToSelf(); 02276 return; 02277 } 02278 02279 // 02280 // If we're not reading the default key, check if the default values 02281 // need to be updated 02282 // 02283 02284 Status = NtQueryKey(hConsoleKey, 02285 KeyBasicInformation, 02286 &KeyInfo, 02287 sizeof(KeyInfo), 02288 &ResultLength); 02289 if (!NT_ERROR(Status)) { 02290 if (DefaultRegInfo.LastWriteTime != KeyInfo.LastWriteTime.QuadPart) { 02291 DefaultRegInfo.LastWriteTime = KeyInfo.LastWriteTime.QuadPart; 02292 if (RegInfo != &DefaultRegInfo) { 02293 GetRegistryValues(L"", &DefaultRegInfo); 02294 *RegInfo = DefaultRegInfo; 02295 } 02296 } 02297 } 02298 02299 // 02300 // Open the console title subkey 02301 // 02302 02303 TranslatedConsoleTitle = TranslateConsoleTitle(ConsoleTitle, NULL, TRUE, TRUE); 02304 if (TranslatedConsoleTitle == NULL) { 02305 NtClose(hConsoleKey); 02306 NtClose(hCurrentUserKey); 02307 CsrRevertToSelf(); 02308 return; 02309 } 02310 Status = MyRegOpenKey(hConsoleKey, 02311 TranslatedConsoleTitle, 02312 &hTitleKey); 02313 ConsoleHeapFree(TranslatedConsoleTitle); 02314 if (!NT_SUCCESS(Status)) { 02315 TranslatedConsoleTitle = TranslateConsoleTitle(ConsoleTitle, NULL, FALSE, TRUE); 02316 if (TranslatedConsoleTitle) { 02317 Status = MyRegOpenKey(hConsoleKey, 02318 TranslatedConsoleTitle, 02319 &hTitleKey); 02320 ConsoleHeapFree(TranslatedConsoleTitle); 02321 } 02322 } 02323 if (!NT_SUCCESS(Status)) { 02324 NtClose(hConsoleKey); 02325 NtClose(hCurrentUserKey); 02326 CsrRevertToSelf(); 02327 return; 02328 } 02329 02330 // 02331 // Initial screen fill 02332 // 02333 02334 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02335 CONSOLE_REGISTRY_FILLATTR, 02336 sizeof(dwValue), (PBYTE)&dwValue))) { 02337 RegInfo->ScreenFill.Attributes = (WORD)dwValue; 02338 } 02339 02340 // 02341 // Initial popup fill 02342 // 02343 02344 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02345 CONSOLE_REGISTRY_POPUPATTR, 02346 sizeof(dwValue), (PBYTE)&dwValue))) { 02347 RegInfo->PopupFill.Attributes = (WORD)dwValue; 02348 } 02349 02350 // 02351 // Initial insert mode 02352 // 02353 02354 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02355 CONSOLE_REGISTRY_INSERTMODE, 02356 sizeof(dwValue), (PBYTE)&dwValue))) { 02357 RegInfo->InsertMode = !!dwValue; 02358 } 02359 02360 // 02361 // Initial quick edit mode 02362 // 02363 02364 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02365 CONSOLE_REGISTRY_QUICKEDIT, 02366 sizeof(dwValue), (PBYTE)&dwValue))) { 02367 RegInfo->QuickEdit = !!dwValue; 02368 } 02369 02370 #ifdef i386 02371 // 02372 // Initial full screen mode 02373 // 02374 02375 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02376 CONSOLE_REGISTRY_FULLSCR, 02377 sizeof(dwValue), (PBYTE)&dwValue))) { 02378 RegInfo->FullScreen = !!dwValue; 02379 } 02380 #endif 02381 02382 #if defined(FE_SB) // scotthsu 02383 // 02384 // Code Page 02385 // 02386 02387 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02388 CONSOLE_REGISTRY_CODEPAGE, 02389 sizeof(dwValue), (PBYTE)&dwValue))) { 02390 RegInfo->CodePage = (UINT)dwValue; 02391 02392 // If this routine specified default settings for console property, 02393 // then make sure code page value when Fae East environment. 02394 // If code page value does not the same to OEMCP and any FE's code page then 02395 // we are override code page value to OEMCP on default console property. 02396 // Because, Far East environment has limitation that doesn not switch to 02397 // another FE's code page by the SetConsoleCP/SetConsoleOutputCP. 02398 // 02399 // Compare of ConsoleTitle and L"" has limit to default property of console. 02400 // It means, this code doesn't care user defined property. 02401 // Content of user defined property has responsibility to themselves. 02402 02403 if ( wcscmp(ConsoleTitle,L"") == 0 && 02404 IsAvailableFarEastCodePage( RegInfo->CodePage ) && 02405 OEMCP != RegInfo->CodePage ) { 02406 RegInfo->CodePage = OEMCP; 02407 } 02408 } 02409 #endif 02410 02411 // 02412 // Initial screen buffer size 02413 // 02414 02415 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02416 CONSOLE_REGISTRY_BUFFERSIZE, 02417 sizeof(dwValue), (PBYTE)&dwValue))) { 02418 RegInfo->ScreenBufferSize.X = LOWORD(dwValue); 02419 RegInfo->ScreenBufferSize.Y = HIWORD(dwValue); 02420 if (RegInfo->ScreenBufferSize.X <= 0) 02421 RegInfo->ScreenBufferSize.X = 1; 02422 if (RegInfo->ScreenBufferSize.Y <= 0) 02423 RegInfo->ScreenBufferSize.Y = 1; 02424 } 02425 02426 // 02427 // Initial window size 02428 // 02429 02430 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02431 CONSOLE_REGISTRY_WINDOWSIZE, 02432 sizeof(dwValue), (PBYTE)&dwValue))) { 02433 RegInfo->WindowSize.X = LOWORD(dwValue); 02434 RegInfo->WindowSize.Y = HIWORD(dwValue); 02435 if (RegInfo->WindowSize.X <= 0) 02436 RegInfo->WindowSize.X = 1; 02437 else if (RegInfo->WindowSize.X > RegInfo->ScreenBufferSize.X) 02438 RegInfo->WindowSize.X = RegInfo->ScreenBufferSize.X; 02439 if (RegInfo->WindowSize.Y <= 0) 02440 RegInfo->WindowSize.Y = 1; 02441 else if (RegInfo->WindowSize.Y > RegInfo->ScreenBufferSize.Y) 02442 RegInfo->WindowSize.Y = RegInfo->ScreenBufferSize.Y; 02443 } 02444 02445 // 02446 // Initial window position 02447 // 02448 02449 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02450 CONSOLE_REGISTRY_WINDOWPOS, 02451 sizeof(dwValue), (PBYTE)&dwValue))) { 02452 RegInfo->WindowOrigin.X = LOWORD(dwValue); 02453 RegInfo->WindowOrigin.Y = HIWORD(dwValue); 02454 RegInfo->AutoPosition = FALSE; 02455 } 02456 02457 // 02458 // Initial font size 02459 // 02460 02461 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02462 CONSOLE_REGISTRY_FONTSIZE, 02463 sizeof(dwValue), (PBYTE)&dwValue))) { 02464 RegInfo->FontSize.X = LOWORD(dwValue); 02465 RegInfo->FontSize.Y = HIWORD(dwValue); 02466 } 02467 02468 // 02469 // Initial font family 02470 // 02471 02472 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02473 CONSOLE_REGISTRY_FONTFAMILY, 02474 sizeof(dwValue), (PBYTE)&dwValue))) { 02475 RegInfo->FontFamily = dwValue; 02476 } 02477 02478 // 02479 // Initial font weight 02480 // 02481 02482 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02483 CONSOLE_REGISTRY_FONTWEIGHT, 02484 sizeof(dwValue), (PBYTE)&dwValue))) { 02485 RegInfo->FontWeight = dwValue; 02486 } 02487 02488 // 02489 // Initial font face name 02490 // 02491 02492 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02493 CONSOLE_REGISTRY_FACENAME, 02494 sizeof(awchFaceName), (PBYTE)awchFaceName))) { 02495 RtlCopyMemory(RegInfo->FaceName, awchFaceName, sizeof(awchFaceName)); 02496 RegInfo->FaceName[NELEM(RegInfo->FaceName) - 1] = 0; 02497 } 02498 02499 // 02500 // Initial cursor size 02501 // 02502 02503 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02504 CONSOLE_REGISTRY_CURSORSIZE, 02505 sizeof(dwValue), (PBYTE)&dwValue))) { 02506 RegInfo->CursorSize = dwValue; 02507 } 02508 02509 // 02510 // Initial history buffer size 02511 // 02512 02513 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02514 CONSOLE_REGISTRY_HISTORYSIZE, 02515 sizeof(dwValue), (PBYTE)&dwValue))) { 02516 RegInfo->HistoryBufferSize = dwValue; 02517 } 02518 02519 // 02520 // Initial number of history buffers 02521 // 02522 02523 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02524 CONSOLE_REGISTRY_HISTORYBUFS, 02525 sizeof(dwValue), (PBYTE)&dwValue))) { 02526 RegInfo->NumberOfHistoryBuffers = dwValue; 02527 } 02528 02529 // 02530 // Initial history duplication mode 02531 // 02532 02533 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02534 CONSOLE_REGISTRY_HISTORYNODUP, 02535 sizeof(dwValue), (PBYTE)&dwValue))) { 02536 RegInfo->HistoryNoDup = dwValue; 02537 } 02538 02539 for (i=0; i<16; i++) { 02540 wsprintf(awchBuffer, CONSOLE_REGISTRY_COLORTABLE, i); 02541 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, awchBuffer, 02542 sizeof(dwValue), (PBYTE)&dwValue))) { 02543 RegInfo->ColorTable[ i ] = dwValue; 02544 } 02545 } 02546 02547 if (RegInfo == &DefaultRegInfo) { 02548 // 02549 // If the common (default) setting has been changed, 02550 // 02551 02552 // 02553 // Get registry for conime flag 02554 // 02555 if (NT_SUCCESS(MyRegQueryValue(hConsoleKey, CONSOLE_REGISTRY_LOAD_CONIME, sizeof dwValue, (PBYTE)&dwValue))) { 02556 gfLoadConIme = (dwValue != 0); 02557 } else { 02558 gfLoadConIme = TRUE; 02559 } 02560 02561 // 02562 // get extended edit mode and keys from registry. 02563 // 02564 if (NT_SUCCESS(MyRegQueryValue(hConsoleKey, 02565 CONSOLE_REGISTRY_EXTENDEDEDITKEY, 02566 sizeof dwValue, 02567 (PBYTE)&dwValue)) && 02568 dwValue <= 1) { 02569 02570 ExtKeyDefBuf buf; 02571 02572 gExtendedEditKey = dwValue; 02573 02574 // 02575 // Initialize Extended Edit keys 02576 // 02577 InitExtendedEditKeys(NULL); 02578 02579 if (NT_SUCCESS(MyRegQueryValue(hConsoleKey, 02580 CONSOLE_REGISTRY_EXTENDEDEDITKEY_CUSTOM, 02581 sizeof buf, 02582 (PBYTE)&buf))) { 02583 InitExtendedEditKeys(&buf); 02584 } 02585 #if DBG 02586 else { 02587 DbgPrint("Error reading ExtendedEditkeyCustom.\n"); 02588 } 02589 #endif 02590 } 02591 else { 02592 gExtendedEditKey = 0; 02593 DBGPRINT(("Error reading ExtendedEditkey.\n")); 02594 } 02595 02596 // 02597 // Word delimiters 02598 // 02599 if (gExtendedEditKey) { 02600 // If extended edit key is given, provide extended word delimiters 02601 // by default. 02602 memcpy((LPBYTE)gaWordDelimChars, (LPBYTE)gaWordDelimCharsDefault, 02603 sizeof gaWordDelimChars[0] * WORD_DELIM_MAX); 02604 } else { 02605 // Otherwise, stick to the original word delimiter. 02606 gaWordDelimChars[0] = L'\0'; 02607 } 02608 02609 // Read word delimiters from registry 02610 if (NT_SUCCESS(MyRegQueryValue(hConsoleKey, 02611 CONSOLE_REGISTRY_WORD_DELIM, 02612 sizeof awchBuffer, 02613 (PBYTE)awchBuffer))) { 02614 // OK, copy it to the word delimiter array. 02615 wcsncpy(gaWordDelimChars, awchBuffer, WORD_DELIM_MAX); 02616 gaWordDelimChars[WORD_DELIM_MAX - 1] = 0; 02617 } 02618 02619 // 02620 // Read Trim Zero Heading flag 02621 // 02622 if (NT_SUCCESS(MyRegQueryValue(hTitleKey, 02623 CONSOLE_REGISTRY_TRIMZEROHEADINGS, 02624 sizeof(dwValue), (PBYTE)&dwValue))) { 02625 gfTrimLeadingZeros = dwValue; 02626 } else { 02627 gfTrimLeadingZeros = FALSE; 02628 } 02629 } 02630 02631 02632 // 02633 // Close the registry keys 02634 // 02635 02636 NtClose(hTitleKey); 02637 NtClose(hConsoleKey); 02638 NtClose(hCurrentUserKey); 02639 CsrRevertToSelf(); 02640 }

NTSTATUS GetScreenBufferInformation IN PSCREEN_INFORMATION  ScreenInfo,
OUT PCOORD  Size,
OUT PCOORD  CursorPosition,
OUT PCOORD  ScrollPosition,
OUT PWORD  Attributes,
OUT PCOORD  CurrentWindowSize,
OUT PCOORD  MaximumWindowSize
 

Definition at line 2093 of file output.c.

References CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, GetWindowLimits(), _WINDOW_LIMITS::MaximumWindowSize, min, SHORT, and Size.

Referenced by SrvGetConsoleScreenBufferInfo().

02105 : 02106 02107 This routine returns data about the screen buffer. 02108 02109 Arguments: 02110 02111 ScreenInfo - Pointer to screen buffer information. 02112 02113 Size - Pointer to location in which to store screen buffer size. 02114 02115 CursorPosition - Pointer to location in which to store the cursor position. 02116 02117 ScrollPosition - Pointer to location in which to store the scroll position. 02118 02119 Attributes - Pointer to location in which to store the default attributes. 02120 02121 CurrentWindowSize - Pointer to location in which to store current window size. 02122 02123 MaximumWindowSize - Pointer to location in which to store maximum window size. 02124 02125 Return Value: 02126 02127 --*/ 02128 02129 { 02130 WINDOW_LIMITS WindowLimits; 02131 02132 *Size = ScreenInfo->ScreenBufferSize; 02133 *CursorPosition = ScreenInfo->BufferInfo.TextInfo.CursorPosition; 02134 ScrollPosition->X = ScreenInfo->Window.Left; 02135 ScrollPosition->Y = ScreenInfo->Window.Top; 02136 *Attributes = ScreenInfo->Attributes; 02137 CurrentWindowSize->X = (SHORT)CONSOLE_WINDOW_SIZE_X(ScreenInfo); 02138 CurrentWindowSize->Y = (SHORT)CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 02139 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 02140 MaximumWindowSize->X = min(80,ScreenInfo->ScreenBufferSize.X); 02141 #if defined(FE_SB) 02142 if (CONSOLE_IS_DBCS_OUTPUTCP(ScreenInfo->Console)) 02143 { 02144 MaximumWindowSize->Y = min(25,ScreenInfo->ScreenBufferSize.Y); 02145 } 02146 else 02147 { 02148 MaximumWindowSize->Y = min(50,ScreenInfo->ScreenBufferSize.Y); 02149 } 02150 #else 02151 MaximumWindowSize->Y = min(50,ScreenInfo->ScreenBufferSize.Y); 02152 #endif 02153 } else { 02154 GetWindowLimits(ScreenInfo, &WindowLimits); 02155 *MaximumWindowSize = WindowLimits.MaximumWindowSize; 02156 } 02157 return STATUS_SUCCESS; 02158 }

DWORD GetTitleFromLinkName IN LPWSTR  szLinkName,
OUT LPWSTR  szTitle
 

Definition at line 16 of file link.c.

References ASSERT, DWORD, L, MAX_TITLE_LENGTH, min, NULL, and szTitle.

Referenced by LoadLinkInfo().

00022 : 00023 00024 This routine returns the title (i.e., display name of the link) in szTitle, 00025 and the number of bytes (not chars) in szTitle. 00026 00027 Arguments: 00028 00029 szLinkName - fully qualified path to link file 00030 szTitle - pointer to buffer to contain title (display name) of the link 00031 00032 i.e.: 00033 "C:\nt\desktop\A Link File Name.lnk" --> "A Link File Name" 00034 00035 Return Value: 00036 00037 number of bytes copied to szTitle 00038 00039 --*/ 00040 { 00041 DWORD dwLen; 00042 LPWSTR pLnk, pDot; 00043 LPWSTR pPath = szLinkName; 00044 00045 // Error checking 00046 ASSERT(szLinkName); 00047 00048 // find filename at end of fully qualified link name and point pLnk to it 00049 for (pLnk = pPath; *pPath; pPath++) 00050 { 00051 if ( (pPath[0] == L'\\' || pPath[0] == L':') && 00052 pPath[1] && 00053 (pPath[1] != L'\\') 00054 ) 00055 pLnk = pPath + 1; 00056 } 00057 00058 // find extension (.lnk) 00059 pPath = pLnk; 00060 for (pDot = NULL; *pPath; pPath++) 00061 { 00062 switch (*pPath) { 00063 case L'.': 00064 pDot = pPath; // remember the last dot 00065 break; 00066 case L'\\': 00067 case L' ': // extensions can't have spaces 00068 pDot = NULL; // forget last dot, it was in a directory 00069 break; 00070 } 00071 } 00072 00073 // if we found the extension, pDot points to it, if not, pDot 00074 // is NULL. 00075 00076 if (pDot) 00077 { 00078 dwLen = (ULONG)((pDot - pLnk) * sizeof(WCHAR)); 00079 } 00080 else 00081 { 00082 dwLen = lstrlenW(pLnk) * sizeof(WCHAR); 00083 } 00084 dwLen = min(dwLen, MAX_TITLE_LENGTH); 00085 00086 RtlCopyMemory(szTitle, pLnk, dwLen); 00087 00088 return dwLen; 00089 }

VOID GetWindowLimits IN PSCREEN_INFORMATION  ScreenInfo,
OUT PWINDOW_LIMITS  WindowLimits
 

Definition at line 207 of file output.c.

References CONSOLE_AUTO_POSITION, CONSOLE_TEXTMODE_BUFFER, ConsoleCaptionY, ConsoleFullScreenX, ConsoleFullScreenY, GetMonitorInfo(), gfInitSystemMetrics, gnConsoleWindows, HorizontalClientToWindow, InitializeSystemMetrics(), max, min, MinimumWidthX, MonitorFromRect(), NULL, PWINDOW_LIMITS, SCR_FONTSIZE(), SHORT, and VerticalClientToWindow.

Referenced by ConsoleWindowProc(), CreateScreenBuffer(), GetAvailableFonts(), GetCurrentFont(), GetScreenBufferInformation(), PropertiesUpdate(), SetScreenBufferFont(), SrvGetLargestConsoleWindowSize(), SrvSetConsoleScreenBufferSize(), and SrvSetConsoleWindowInfo().

00211 { 00212 HMONITOR hMonitor; 00213 MONITORINFO MonitorInfo = {sizeof(MonitorInfo)}; 00214 COORD FontSize; 00215 00216 // 00217 // If the system metrics have changed or there aren't any console 00218 // windows around, reinitialize the global valeus. 00219 // 00220 00221 if (gfInitSystemMetrics || gnConsoleWindows == 0) { 00222 InitializeSystemMetrics(); 00223 } 00224 00225 if (ScreenInfo->Console && 00226 (ScreenInfo->Console->hWnd || !(ScreenInfo->Console->Flags & CONSOLE_AUTO_POSITION)) && 00227 ((hMonitor = MonitorFromRect(&ScreenInfo->Console->WindowRect, MONITOR_DEFAULTTOPRIMARY)) != NULL) && 00228 GetMonitorInfo(hMonitor, &MonitorInfo)) { 00229 WindowLimits->FullScreenSize.X = (SHORT)(MonitorInfo.rcWork.right - MonitorInfo.rcWork.left); 00230 WindowLimits->FullScreenSize.Y = (SHORT)(MonitorInfo.rcWork.bottom - MonitorInfo.rcWork.top - ConsoleCaptionY); 00231 } else { 00232 WindowLimits->FullScreenSize.X = (SHORT)ConsoleFullScreenX; 00233 WindowLimits->FullScreenSize.Y = (SHORT)ConsoleFullScreenY; 00234 } 00235 00236 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00237 FontSize = SCR_FONTSIZE(ScreenInfo); 00238 } else { 00239 FontSize.X = 1; 00240 FontSize.Y = 1; 00241 } 00242 00243 WindowLimits->MinimumWindowSize.X = ((MinimumWidthX - VerticalClientToWindow + FontSize.X - 1) / FontSize.X); 00244 WindowLimits->MinimumWindowSize.Y = 1; 00245 WindowLimits->MaximumWindowSize.X = min(WindowLimits->FullScreenSize.X/FontSize.X, ScreenInfo->ScreenBufferSize.X); 00246 WindowLimits->MaximumWindowSize.X = max(WindowLimits->MaximumWindowSize.X, WindowLimits->MinimumWindowSize.X); 00247 WindowLimits->MaximumWindowSize.Y = min(WindowLimits->FullScreenSize.Y/FontSize.Y, ScreenInfo->ScreenBufferSize.Y); 00248 WindowLimits->MaxWindow.X = WindowLimits->MaximumWindowSize.X*FontSize.X + VerticalClientToWindow; 00249 WindowLimits->MaxWindow.Y = WindowLimits->MaximumWindowSize.Y*FontSize.Y + HorizontalClientToWindow; 00250 }

int APIENTRY GreGetDIBitsInternal HDC  hdc,
HBITMAP  hBitmap,
UINT  iStartScan,
UINT  cNumScan,
LPBYTE  pjBits,
LPBITMAPINFO  pBitsInfo,
UINT  iUsage,
UINT  cjMaxBits,
UINT  cjMaxInfo
 

Referenced by BMPtoDIB().

NTSTATUS GrowIoHandleTable IN PCONSOLE_PER_PROCESS_DATA  ProcessData  ) 
 

Definition at line 1234 of file w32/ntcon/server/handle.c.

References ASSERT, CONSOLE_FREE_HANDLE, CONSOLE_INITIAL_IO_HANDLES, CONSOLE_IO_HANDLE_INCREMENT, ConsoleHeapAlloc, ConsoleHeapFree, HANDLE_DATA, HANDLE_TAG, _HANDLE_DATA::HandleType, MAKE_TAG, and NULL.

Referenced by AllocateIoHandle().

01240 : 01241 01242 This routine grows the per-process io handle table. 01243 01244 Arguments: 01245 01246 ProcessData - Pointer to the per-process data structure. 01247 01248 Return Value: 01249 01250 --*/ 01251 01252 { 01253 PHANDLE_DATA NewTable; 01254 ULONG i; 01255 ULONG MaxFileHandles; 01256 01257 ASSERT(ProcessData->Foo == 0xF00); 01258 MaxFileHandles = ProcessData->HandleTableSize + CONSOLE_IO_HANDLE_INCREMENT; 01259 NewTable = (PHANDLE_DATA)ConsoleHeapAlloc(MAKE_TAG( HANDLE_TAG ),MaxFileHandles * sizeof(HANDLE_DATA)); 01260 if (NewTable == NULL) { 01261 return STATUS_NO_MEMORY; 01262 } 01263 RtlCopyMemory(NewTable, ProcessData->HandleTablePtr, 01264 ProcessData->HandleTableSize * sizeof(HANDLE_DATA)); 01265 for (i=ProcessData->HandleTableSize;i<MaxFileHandles;i++) { 01266 NewTable[i].HandleType = CONSOLE_FREE_HANDLE; 01267 } 01268 if (ProcessData->HandleTableSize != CONSOLE_INITIAL_IO_HANDLES) { 01269 ConsoleHeapFree(ProcessData->HandleTablePtr); 01270 } 01271 ProcessData->HandleTablePtr = NewTable; 01272 ProcessData->HandleTableSize = MaxFileHandles; 01273 ASSERT(ProcessData->Foo == 0xF00); 01274 ASSERT(ProcessData->HandleTableSize != 0); 01275 ASSERT(ProcessData->HandleTableSize <= 0x0000FFFF); 01276 return STATUS_SUCCESS; 01277 }

VOID HandleCtrlEvent IN PCONSOLE_INFORMATION  Console,
IN DWORD  EventType
 

Definition at line 3430 of file ntcon/server/input.c.

References ASSERT, CONSOLE_CTRL_BREAK_FLAG, CONSOLE_CTRL_C_FLAG, CONSOLE_CTRL_CLOSE_FLAG, and FALSE.

Referenced by ConsoleWindowProc(), HandleKeyEvent(), and SrvGenerateConsoleCtrlEvent().

03434 { 03435 switch (EventType) { 03436 case CTRL_C_EVENT: 03437 Console->CtrlFlags |= CONSOLE_CTRL_C_FLAG; 03438 break; 03439 case CTRL_BREAK_EVENT: 03440 Console->CtrlFlags |= CONSOLE_CTRL_BREAK_FLAG; 03441 break; 03442 case CTRL_CLOSE_EVENT: 03443 Console->CtrlFlags |= CONSOLE_CTRL_CLOSE_FLAG; 03444 break; 03445 default: 03446 ASSERT (FALSE); 03447 } 03448 }

VOID HandleFocusEvent IN PCONSOLE_INFORMATION  Console,
IN BOOL  bSetFocus
 

Definition at line 3369 of file ntcon/server/input.c.

References CONSOLE_CONNECTED_TO_EMULATOR, CONSOLE_VDM_REGISTERED, NtUserSetInformationThread(), TIF_DOSEMULATOR, TIF_VDMAPP, and WriteInputBuffer().

Referenced by ConsoleWindowProc(), and DisplayModeTransition().

03373 { 03374 INPUT_RECORD InputEvent; 03375 ULONG EventsWritten; 03376 USERTHREAD_FLAGS Flags; 03377 03378 InputEvent.EventType = FOCUS_EVENT; 03379 InputEvent.Event.FocusEvent.bSetFocus = bSetFocus; 03380 03381 Flags.dwFlags = 0; 03382 if (bSetFocus) { 03383 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 03384 Flags.dwFlags |= TIF_VDMAPP; 03385 } 03386 if (Console->Flags & CONSOLE_CONNECTED_TO_EMULATOR) { 03387 Flags.dwFlags |= TIF_DOSEMULATOR; 03388 } 03389 } 03390 03391 Flags.dwMask = (TIF_VDMAPP | TIF_DOSEMULATOR); 03392 NtUserSetInformationThread(Console->InputThreadInfo->ThreadHandle, 03393 UserThreadFlags, &Flags, sizeof(Flags)); 03394 EventsWritten = WriteInputBuffer( Console, 03395 &Console->InputBuffer, 03396 &InputEvent, 03397 1 03398 ); 03399 #if DBG 03400 if (EventsWritten != 1) { 03401 OutputDebugStringA("PutInputInBuffer: EventsWritten != 1, 1 expected\n"); 03402 } 03403 #endif 03404 }

VOID HandleKeyEvent IN PCONSOLE_INFORMATION  Console,
IN HWND  hWnd,
IN UINT  Message,
IN WPARAM  wParam,
IN LPARAM  lParam
 

Definition at line 2397 of file ntcon/server/input.c.

References ASSERT, BOOL, _SCREEN_INFORMATION::BufferInfo, BYTE, _ROW::CharRow, ClearScroll(), ClearSelection(), CodePageToCharSet(), CONIME_HOTKEY, CONIME_KEYDATA, CONIME_NOTIFY_VK_KANA, CONSOLE_CTRL_BREAK_SEEN, CONSOLE_CTRL_C_SEEN, CONSOLE_IGNORE_NEXT_KEYUP, CONSOLE_IS_IME_ENABLED, CONSOLE_MOUSE_DOWN, CONSOLE_MOUSE_SELECTION, CONSOLE_SCROLLBAR_TRACKING, CONSOLE_SCROLLING, CONSOLE_SELECTING, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_SUSPENDED, CONSOLE_TEXTMODE_BUFFER, CONSOLE_VDM_REGISTERED, CONSOLE_WINDOW_SIZE_Y, ConsoleHideCursor(), ConsoleShowCursor(), CTRL_BUT_NOT_ALT, DialogBoxCount, DoCopy(), DWORD, ExtendSelection(), FALSE, FlushInputBuffer(), GetControlKeyState(), GetKeyboardState, GetKeyState(), HandleCtrlEvent(), HorizontalScroll(), hWnd, ImmConversionToConsole(), IsSystemKey(), KEY_PRESSED, KEY_TRANSITION_UP, MakeCursorVisible(), MAX_CHARS_FROM_1_KEYSTROKE, MyInvert(), NT_SUCCESS, NtUserCheckImeHotKey(), NtUserGetImeHotKey(), NULL, PostMessage(), RetrieveKeyInfo(), _SCREEN_INFORMATION::ScreenBufferSize, SHORT, StoreSelection(), TerminateRead(), ToUnicodeEx(), TRUE, UINT, VerticalScroll(), and WriteInputBuffer().

Referenced by ConsoleWindowProc(), and HandleSysKeyEvent().

02404 { 02405 INPUT_RECORD InputEvent; 02406 BOOLEAN ContinueProcessing; 02407 ULONG EventsWritten; 02408 WORD VirtualKeyCode; 02409 ULONG ControlKeyState; 02410 BOOL bKeyDown; 02411 BOOL bGenerateBreak=FALSE; 02412 #ifdef FE_SB 02413 BOOL KeyMessageFromConsoleIME; 02414 #endif 02415 02416 #ifdef FE_SB 02417 // v-HirShi Sep.21.1995 For Console IME 02418 if ((WM_KEYFIRST+CONIME_KEYDATA) <= Message && Message <= (WM_KEYLAST+CONIME_KEYDATA)) { 02419 Message -= CONIME_KEYDATA ; 02420 KeyMessageFromConsoleIME = TRUE ; 02421 } 02422 else { 02423 KeyMessageFromConsoleIME = FALSE ; 02424 } 02425 #endif 02426 /* 02427 * BOGUS for WM_CHAR/WM_DEADCHAR, in which LOWORD(lParam) is a character 02428 */ 02429 VirtualKeyCode = LOWORD(wParam); 02430 ControlKeyState = GetControlKeyState(lParam); 02431 bKeyDown = !(lParam & KEY_TRANSITION_UP); 02432 02433 // 02434 // Make sure we retrieve the key info first, or we could chew up 02435 // unneeded space in the key info table if we bail out early. 02436 // 02437 02438 InputEvent.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode; 02439 InputEvent.Event.KeyEvent.wVirtualScanCode = (BYTE)(HIWORD(lParam)); 02440 if (Message == WM_CHAR || Message == WM_SYSCHAR || 02441 Message == WM_DEADCHAR || Message == WM_SYSDEADCHAR) { 02442 RetrieveKeyInfo(hWnd, 02443 &InputEvent.Event.KeyEvent.wVirtualKeyCode, 02444 &InputEvent.Event.KeyEvent.wVirtualScanCode, 02445 !(Console->InputBuffer.ImeMode.Open ^ KeyMessageFromConsoleIME)); 02446 VirtualKeyCode = InputEvent.Event.KeyEvent.wVirtualKeyCode; 02447 } 02448 02449 // 02450 // If this is a key up message, should we ignore it? We do this 02451 // so that if a process reads a line from the input buffer, the 02452 // key up event won't get put in the buffer after the read 02453 // completes. 02454 // 02455 02456 if (Console->Flags & CONSOLE_IGNORE_NEXT_KEYUP) { 02457 Console->Flags &= ~CONSOLE_IGNORE_NEXT_KEYUP; 02458 if (!bKeyDown) 02459 return; 02460 } 02461 02462 #ifdef FE_SB 02463 // v-HirShi Sep.21.1995 For Console IME 02464 if (KeyMessageFromConsoleIME) { 02465 goto FromConsoleIME ; 02466 } 02467 #endif 02468 02469 if (Console->Flags & CONSOLE_SELECTING) { 02470 02471 if (!bKeyDown) { 02472 return; 02473 } 02474 02475 // 02476 // if escape or ctrl-c, cancel selection 02477 // 02478 02479 if (!(Console->SelectionFlags & CONSOLE_MOUSE_DOWN) ) { 02480 if (VirtualKeyCode == VK_ESCAPE || 02481 (VirtualKeyCode == 'C' && 02482 (GetKeyState(VK_CONTROL) & KEY_PRESSED) )) { 02483 ClearSelection(Console); 02484 return; 02485 } else if (VirtualKeyCode == VK_RETURN) { 02486 02487 // if return, copy selection 02488 02489 DoCopy(Console); 02490 return; 02491 } 02492 } 02493 if (!(Console->SelectionFlags & CONSOLE_MOUSE_SELECTION)) { 02494 if ((Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) && 02495 (VirtualKeyCode == VK_RIGHT || 02496 VirtualKeyCode == VK_LEFT || 02497 VirtualKeyCode == VK_UP || 02498 VirtualKeyCode == VK_DOWN || 02499 VirtualKeyCode == VK_NEXT || 02500 VirtualKeyCode == VK_PRIOR || 02501 VirtualKeyCode == VK_END || 02502 VirtualKeyCode == VK_HOME 02503 ) ) { 02504 PSCREEN_INFORMATION ScreenInfo; 02505 #ifdef FE_SB 02506 SHORT RowIndex; 02507 PROW Row; 02508 BYTE KAttrs; 02509 SHORT NextRightX; 02510 SHORT NextLeftX; 02511 #endif 02512 02513 ScreenInfo = Console->CurrentScreenBuffer; 02514 02515 // 02516 // see if shift is down. if so, we're extending 02517 // the selection. otherwise, we're resetting the 02518 // anchor 02519 // 02520 02521 ConsoleHideCursor(ScreenInfo); 02522 #ifdef FE_SB 02523 RowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y) % ScreenInfo->ScreenBufferSize.Y; 02524 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 02525 02526 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02527 { 02528 KAttrs = Row->CharRow.KAttrs[ScreenInfo->BufferInfo.TextInfo.CursorPosition.X]; 02529 if (KAttrs & ATTR_LEADING_BYTE) 02530 NextRightX = 2; 02531 else 02532 NextRightX = 1; 02533 } 02534 else 02535 { 02536 NextRightX = 1; 02537 } 02538 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X > 0) { 02539 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 02540 KAttrs = Row->CharRow.KAttrs[ScreenInfo->BufferInfo.TextInfo.CursorPosition.X-1]; 02541 if (KAttrs & ATTR_TRAILING_BYTE) 02542 NextLeftX = 2; 02543 else if (KAttrs & ATTR_LEADING_BYTE) { 02544 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X-1 > 0) { 02545 KAttrs = Row->CharRow.KAttrs[ScreenInfo->BufferInfo.TextInfo.CursorPosition.X-2]; 02546 if (KAttrs & ATTR_TRAILING_BYTE) 02547 NextLeftX = 3; 02548 else 02549 NextLeftX = 2; 02550 } 02551 else 02552 NextLeftX = 1; 02553 } 02554 else 02555 NextLeftX = 1; 02556 } 02557 else 02558 NextLeftX = 1; 02559 } 02560 02561 switch (VirtualKeyCode) { 02562 case VK_RIGHT: 02563 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X+NextRightX < ScreenInfo->ScreenBufferSize.X) { 02564 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X+=NextRightX; 02565 } 02566 break; 02567 case VK_LEFT: 02568 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X > 0) { 02569 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X-=NextLeftX; 02570 } 02571 break; 02572 case VK_UP: 02573 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y > 0) { 02574 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y-=1; 02575 } 02576 break; 02577 case VK_DOWN: 02578 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y+1 < ScreenInfo->ScreenBufferSize.Y) { 02579 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y+=1; 02580 } 02581 break; 02582 case VK_NEXT: 02583 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y += CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 02584 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y >= ScreenInfo->ScreenBufferSize.Y) { 02585 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = ScreenInfo->ScreenBufferSize.Y-1; 02586 } 02587 break; 02588 case VK_PRIOR: 02589 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y -= CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 02590 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y < 0) { 02591 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = 0; 02592 } 02593 break; 02594 case VK_END: 02595 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = ScreenInfo->ScreenBufferSize.Y-CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 02596 break; 02597 case VK_HOME: 02598 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X = 0; 02599 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = 0; 02600 break; 02601 default: 02602 ASSERT(FALSE); 02603 } 02604 #else // FE_SB 02605 switch (VirtualKeyCode) { 02606 case VK_RIGHT: 02607 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X+1 < ScreenInfo->ScreenBufferSize.X) { 02608 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X+=1; 02609 } 02610 break; 02611 case VK_LEFT: 02612 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.X > 0) { 02613 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X-=1; 02614 } 02615 break; 02616 case VK_UP: 02617 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y > 0) { 02618 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y-=1; 02619 } 02620 break; 02621 case VK_DOWN: 02622 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y+1 < ScreenInfo->ScreenBufferSize.Y) { 02623 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y+=1; 02624 } 02625 break; 02626 case VK_NEXT: 02627 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y += CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 02628 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y >= ScreenInfo->ScreenBufferSize.Y) { 02629 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = ScreenInfo->ScreenBufferSize.Y-1; 02630 } 02631 break; 02632 case VK_PRIOR: 02633 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y -= CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 02634 if (ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y < 0) { 02635 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = 0; 02636 } 02637 break; 02638 case VK_END: 02639 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = ScreenInfo->ScreenBufferSize.Y-CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 02640 break; 02641 case VK_HOME: 02642 ScreenInfo->BufferInfo.TextInfo.CursorPosition.X = 0; 02643 ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y = 0; 02644 break; 02645 default: 02646 ASSERT(FALSE); 02647 } 02648 #endif // FE_SB 02649 ConsoleShowCursor(ScreenInfo); 02650 if (GetKeyState(VK_SHIFT) & KEY_PRESSED) { 02651 { 02652 ExtendSelection(Console,ScreenInfo->BufferInfo.TextInfo.CursorPosition); 02653 } 02654 } else { 02655 if (Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY) { 02656 MyInvert(Console,&Console->SelectionRect); 02657 Console->SelectionFlags &= ~CONSOLE_SELECTION_NOT_EMPTY; 02658 ConsoleShowCursor(ScreenInfo); 02659 } 02660 Console->SelectionAnchor = ScreenInfo->BufferInfo.TextInfo.CursorPosition; 02661 MakeCursorVisible(ScreenInfo,Console->SelectionAnchor); 02662 Console->SelectionRect.Left = Console->SelectionRect.Right = Console->SelectionAnchor.X; 02663 Console->SelectionRect.Top = Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 02664 } 02665 return; 02666 } 02667 } else if (!(Console->SelectionFlags & CONSOLE_MOUSE_DOWN)) { 02668 02669 // 02670 // if in mouse selection mode and user hits a key, cancel selection 02671 // 02672 02673 if (!IsSystemKey(VirtualKeyCode)) { 02674 ClearSelection(Console); 02675 } 02676 } 02677 } else if (Console->Flags & CONSOLE_SCROLLING) { 02678 02679 if (!bKeyDown) { 02680 return; 02681 } 02682 02683 // 02684 // if escape, enter or ctrl-c, cancel scroll 02685 // 02686 02687 if (VirtualKeyCode == VK_ESCAPE || 02688 VirtualKeyCode == VK_RETURN || 02689 (VirtualKeyCode == 'C' && 02690 (GetKeyState(VK_CONTROL) & KEY_PRESSED) )) { 02691 ClearScroll(Console); 02692 } else { 02693 WORD ScrollCommand; 02694 BOOL Horizontal=FALSE; 02695 switch (VirtualKeyCode) { 02696 case VK_UP: 02697 ScrollCommand = SB_LINEUP; 02698 break; 02699 case VK_DOWN: 02700 ScrollCommand = SB_LINEDOWN; 02701 break; 02702 case VK_LEFT: 02703 ScrollCommand = SB_LINEUP; 02704 Horizontal=TRUE; 02705 break; 02706 case VK_RIGHT: 02707 ScrollCommand = SB_LINEDOWN; 02708 Horizontal=TRUE; 02709 break; 02710 case VK_NEXT: 02711 ScrollCommand = SB_PAGEDOWN; 02712 break; 02713 case VK_PRIOR: 02714 ScrollCommand = SB_PAGEUP; 02715 break; 02716 case VK_END: 02717 ScrollCommand = SB_PAGEDOWN; 02718 Horizontal=TRUE; 02719 break; 02720 case VK_HOME: 02721 ScrollCommand = SB_PAGEUP; 02722 Horizontal=TRUE; 02723 break; 02724 case VK_SHIFT: 02725 case VK_CONTROL: 02726 case VK_MENU: 02727 return; 02728 default: 02729 Beep(800, 200); 02730 return; 02731 } 02732 if (Horizontal) 02733 HorizontalScroll(Console->CurrentScreenBuffer, ScrollCommand, 0); 02734 else 02735 VerticalScroll(Console, Console->CurrentScreenBuffer,ScrollCommand,0); 02736 } 02737 return; 02738 } 02739 02740 // 02741 // if the user is inputting chars at an inappropriate time, beep. 02742 // 02743 02744 if ((Console->Flags & (CONSOLE_SELECTING | CONSOLE_SCROLLING | CONSOLE_SCROLLBAR_TRACKING)) && 02745 bKeyDown && 02746 !IsSystemKey(VirtualKeyCode)) { 02747 Beep(800, 200); 02748 return; 02749 } 02750 02751 // 02752 // if in fullscreen mode, process PrintScreen 02753 // 02754 02755 #ifdef LATER 02756 // 02757 // Changed this code to get commas to work (build 485). 02758 // 02759 // Therese, the problem is that WM_CHAR/WM_SYSCHAR messages come through 02760 // here - in this case, LOWORD(wParam) is a character value and not a virtual 02761 // key. It happens that VK_SNAPSHOT == 0x2c, and the character value for a 02762 // comma is also == 0x2c, so execution enters this conditional when a comma 02763 // is hit. Commas aren't coming out because of the newly entered return 02764 // statement. 02765 // 02766 // HandleKeyEvent() is making many virtual key comparisons - need to make 02767 // sure that for each one, there is either no corresponding character value, 02768 // or that you check before you compare so that you are comparing two values 02769 // that have the same data type. 02770 // 02771 // I added the message comparison so that we know we're checking virtual 02772 // keys against virtual keys and not characters. 02773 // 02774 // - scottlu 02775 // 02776 02777 #endif 02778 02779 if (Message != WM_CHAR && Message != WM_SYSCHAR && 02780 VirtualKeyCode == VK_SNAPSHOT && 02781 !(Console->ReserveKeys & (CONSOLE_ALTPRTSC | CONSOLE_PRTSC )) ) { 02782 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 02783 Console->SelectionFlags |= CONSOLE_SELECTION_NOT_EMPTY; 02784 Console->SelectionRect = Console->CurrentScreenBuffer->Window; 02785 StoreSelection(Console); 02786 Console->SelectionFlags &= ~CONSOLE_SELECTION_NOT_EMPTY; 02787 } 02788 return; 02789 } 02790 02791 // 02792 // IME stuff 02793 // 02794 if (!(Console->Flags & CONSOLE_VDM_REGISTERED)) { 02795 LPARAM lParamForHotKey ; 02796 DWORD HotkeyID ; 02797 lParamForHotKey = lParam ; 02798 02799 HotkeyID = NtUserCheckImeHotKey( (VirtualKeyCode & 0x00ff),lParamForHotKey) ; 02800 // 02801 // If it's direct KL switching hokey, handle it here 02802 // regardless the system is IME enabled or not. 02803 // 02804 if (HotkeyID >= IME_HOTKEY_DSWITCH_FIRST && HotkeyID <= IME_HOTKEY_DSWITCH_LAST) { 02805 UINT uModifier, uVkey; 02806 HKL hkl; 02807 02808 RIPMSG1(RIP_VERBOSE, "HandleKeyEvent: handling IME HOTKEY id=%x", HotkeyID); 02809 if (NtUserGetImeHotKey(HotkeyID, &uModifier, &uVkey, &hkl) && hkl != NULL) { 02810 BYTE bCharSetSys = CodePageToCharSet(GetACP()); 02811 WPARAM wpSysChar = 0; 02812 CHARSETINFO cs; 02813 02814 if (TranslateCharsetInfo((LPDWORD)LOWORD(hkl), &cs, TCI_SRCLOCALE)) { 02815 if (bCharSetSys == cs.ciCharset) { 02816 wpSysChar = INPUTLANGCHANGE_SYSCHARSET; 02817 } 02818 } 02819 PostMessage(hWnd, WM_INPUTLANGCHANGEREQUEST, wpSysChar, (LPARAM)hkl); 02820 } 02821 return; 02822 } 02823 02824 if (!(Console->InputBuffer.ImeMode.Disable) && CONSOLE_IS_IME_ENABLED()) { 02825 02826 if (HotkeyID != IME_INVALID_HOTKEY) { 02827 switch(HotkeyID) { 02828 case IME_JHOTKEY_CLOSE_OPEN: 02829 { 02830 BOOL fOpen = Console->InputBuffer.ImeMode.Open; 02831 if (!bKeyDown) 02832 break ; 02833 02834 Console->InputBuffer.ImeMode.Open = !fOpen ; 02835 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 02836 CONIME_HOTKEY, 02837 (WPARAM)Console->ConsoleHandle, 02838 HotkeyID))) { 02839 break; 02840 } 02841 02842 // Update in the system conversion mode buffer. 02843 GetImeKeyState(Console, NULL); 02844 02845 break ; 02846 } 02847 case IME_CHOTKEY_IME_NONIME_TOGGLE: 02848 case IME_THOTKEY_IME_NONIME_TOGGLE: 02849 case IME_CHOTKEY_SHAPE_TOGGLE: 02850 case IME_THOTKEY_SHAPE_TOGGLE: 02851 case IME_CHOTKEY_SYMBOL_TOGGLE: 02852 case IME_THOTKEY_SYMBOL_TOGGLE: 02853 case IME_KHOTKEY_SHAPE_TOGGLE: 02854 case IME_KHOTKEY_HANJACONVERT: 02855 case IME_KHOTKEY_ENGLISH: 02856 case IME_ITHOTKEY_RESEND_RESULTSTR: 02857 case IME_ITHOTKEY_PREVIOUS_COMPOSITION: 02858 case IME_ITHOTKEY_UISTYLE_TOGGLE: 02859 default: 02860 { 02861 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 02862 CONIME_HOTKEY, 02863 (WPARAM)Console->ConsoleHandle, 02864 HotkeyID))) { 02865 break; 02866 } 02867 02868 // Update in the system conversion mode buffer. 02869 GetImeKeyState(Console, NULL); 02870 02871 break ; 02872 } 02873 } 02874 return ; 02875 } 02876 02877 if ( CTRL_BUT_NOT_ALT(ControlKeyState) && 02878 (bKeyDown) ) { 02879 if (VirtualKeyCode == 'C' && 02880 Console->InputBuffer.InputMode & ENABLE_PROCESSED_INPUT) { 02881 goto FromConsoleIME ; 02882 } 02883 else if (VirtualKeyCode == VK_CANCEL) { 02884 goto FromConsoleIME ; 02885 } 02886 else if (VirtualKeyCode == 'S'){ 02887 goto FromConsoleIME ; 02888 } 02889 } 02890 else if (VirtualKeyCode == VK_PAUSE ){ 02891 goto FromConsoleIME ; 02892 } 02893 else if ( ((VirtualKeyCode == VK_SHIFT) || 02894 (VirtualKeyCode == VK_CONTROL) || 02895 (VirtualKeyCode == VK_CAPITAL) || 02896 (VirtualKeyCode == VK_KANA) || // VK_KANA == VK_HANGUL 02897 (VirtualKeyCode == VK_JUNJA) || 02898 (VirtualKeyCode == VK_HANJA) || 02899 (VirtualKeyCode == VK_NUMLOCK) || 02900 (VirtualKeyCode == VK_SCROLL) ) 02901 && 02902 !(Console->InputBuffer.ImeMode.Unavailable) && 02903 !(Console->InputBuffer.ImeMode.Open) 02904 ) 02905 { 02906 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 02907 Message+CONIME_KEYDATA, 02908 (WPARAM)LOWORD(wParam)<<16|LOWORD(VirtualKeyCode), 02909 lParam 02910 ))) { 02911 return; 02912 } 02913 goto FromConsoleIME ; 02914 } 02915 02916 if (!Console->InputBuffer.ImeMode.Unavailable && Console->InputBuffer.ImeMode.Open) { 02917 if (! (HIWORD(lParam) & KF_REPEAT)) 02918 { 02919 if (PRIMARYLANGID(LOWORD(Console->hklActive)) == LANG_JAPANESE && 02920 (BYTE)wParam == VK_KANA) { 02921 if (!NT_SUCCESS(ConsoleImeMessagePump(Console, 02922 CONIME_NOTIFY_VK_KANA, 02923 0, 02924 0 02925 ))) { 02926 return; 02927 } 02928 } 02929 } 02930 02931 ConsoleImeMessagePump(Console, 02932 Message+CONIME_KEYDATA, 02933 LOWORD(wParam)<<16|LOWORD(VirtualKeyCode), 02934 lParam 02935 ); 02936 return ; 02937 } 02938 } 02939 } 02940 FromConsoleIME: 02941 02942 // 02943 // ignore key strokes that will generate CHAR messages. this is only 02944 // necessary while a dialog box is up. 02945 // 02946 02947 if (DialogBoxCount > 0) { 02948 if (Message != WM_CHAR && Message != WM_SYSCHAR && Message != WM_DEADCHAR && Message != WM_SYSDEADCHAR) { 02949 WCHAR awch[MAX_CHARS_FROM_1_KEYSTROKE]; 02950 int cwch; 02951 BYTE KeyState[256]; 02952 02953 GetKeyboardState(KeyState); 02954 cwch = ToUnicodeEx((UINT)wParam,HIWORD(lParam),KeyState,awch, 02955 MAX_CHARS_FROM_1_KEYSTROKE, 02956 //TM_POSTCHARBREAKS | (KeyState(VK_MENU) & 1)); 02957 TM_POSTCHARBREAKS, 02958 (HKL)NULL); 02959 if (cwch != 0) { 02960 return; 02961 } 02962 } else { 02963 // remember to generate break 02964 if (Message == WM_CHAR) { 02965 bGenerateBreak=TRUE; 02966 } 02967 } 02968 } 02969 02970 #ifdef FE_IME 02971 // ignore key stroke while IME property is up. 02972 if (Console->InputBuffer.hWndConsoleIME) 02973 return; 02974 #endif 02975 02976 InputEvent.EventType = KEY_EVENT; 02977 InputEvent.Event.KeyEvent.bKeyDown = bKeyDown; 02978 InputEvent.Event.KeyEvent.wRepeatCount = LOWORD(lParam); 02979 02980 if (Message == WM_CHAR || Message == WM_SYSCHAR || Message == WM_DEADCHAR || Message == WM_SYSDEADCHAR) { 02981 // If this is a fake character, zero the scancode. 02982 if (lParam & 0x02000000) { 02983 InputEvent.Event.KeyEvent.wVirtualScanCode = 0; 02984 } 02985 InputEvent.Event.KeyEvent.dwControlKeyState = GetControlKeyState(lParam); 02986 if (Message == WM_CHAR || Message == WM_SYSCHAR) { 02987 InputEvent.Event.KeyEvent.uChar.UnicodeChar = (WCHAR)wParam; 02988 } else { 02989 InputEvent.Event.KeyEvent.uChar.UnicodeChar = (WCHAR)0; 02990 } 02991 } else { 02992 // if alt-gr, ignore 02993 if (lParam & 0x02000000) { 02994 return; 02995 } 02996 InputEvent.Event.KeyEvent.dwControlKeyState = ControlKeyState; 02997 InputEvent.Event.KeyEvent.uChar.UnicodeChar = 0; 02998 } 02999 03000 #ifdef FE_IME 03001 if (CONSOLE_IS_IME_ENABLED()) { 03002 // MSKK August.22.1993 KazuM 03003 DWORD dwConversion; 03004 03005 if (!NT_SUCCESS(GetImeKeyState(Console, &dwConversion))) { 03006 return; 03007 } 03008 03009 InputEvent.Event.KeyEvent.dwControlKeyState |= ImmConversionToConsole(dwConversion); 03010 } 03011 #endif 03012 03013 ContinueProcessing=TRUE; 03014 03015 if (CTRL_BUT_NOT_ALT(InputEvent.Event.KeyEvent.dwControlKeyState) && 03016 InputEvent.Event.KeyEvent.bKeyDown) { 03017 03018 // 03019 // check for ctrl-c, if in line input mode. 03020 // 03021 03022 if (InputEvent.Event.KeyEvent.wVirtualKeyCode == 'C' && 03023 Console->InputBuffer.InputMode & ENABLE_PROCESSED_INPUT) { 03024 HandleCtrlEvent(Console,CTRL_C_EVENT); 03025 if (!Console->PopupCount) 03026 TerminateRead(Console,&Console->InputBuffer,CONSOLE_CTRL_C_SEEN); 03027 if (!(Console->Flags & CONSOLE_SUSPENDED)) { 03028 ContinueProcessing=FALSE; 03029 } 03030 } 03031 03032 // 03033 // check for ctrl-break. 03034 // 03035 03036 else if (InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_CANCEL) { 03037 FlushInputBuffer(&Console->InputBuffer); 03038 HandleCtrlEvent(Console,CTRL_BREAK_EVENT); 03039 if (!Console->PopupCount) 03040 TerminateRead(Console,&Console->InputBuffer,CONSOLE_CTRL_BREAK_SEEN); 03041 if (!(Console->Flags & CONSOLE_SUSPENDED)) { 03042 ContinueProcessing=FALSE; 03043 } 03044 } 03045 03046 // 03047 // don't write ctrl-esc to the input buffer 03048 // 03049 03050 else if (InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE && 03051 !(Console->ReserveKeys & CONSOLE_CTRLESC)) { 03052 ContinueProcessing=FALSE; 03053 } 03054 } else if (InputEvent.Event.KeyEvent.dwControlKeyState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED) && 03055 InputEvent.Event.KeyEvent.bKeyDown && 03056 InputEvent.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE && 03057 !(Console->ReserveKeys & CONSOLE_ALTESC)) { 03058 ContinueProcessing=FALSE; 03059 } 03060 03061 if (ContinueProcessing) { 03062 EventsWritten = WriteInputBuffer( Console, 03063 &Console->InputBuffer, 03064 &InputEvent, 03065 1 03066 ); 03067 if (EventsWritten && bGenerateBreak) { 03068 InputEvent.Event.KeyEvent.bKeyDown = FALSE; 03069 WriteInputBuffer( Console, 03070 &Console->InputBuffer, 03071 &InputEvent, 03072 1 03073 ); 03074 } 03075 } 03076 return; 03077 }

VOID HandleMenuEvent IN PCONSOLE_INFORMATION  Console,
IN DWORD  wParam
 

Definition at line 3407 of file ntcon/server/input.c.

References WriteInputBuffer().

Referenced by ConsoleWindowProc().

03411 { 03412 INPUT_RECORD InputEvent; 03413 ULONG EventsWritten; 03414 03415 InputEvent.EventType = MENU_EVENT; 03416 InputEvent.Event.MenuEvent.dwCommandId = wParam; 03417 EventsWritten = WriteInputBuffer( Console, 03418 &Console->InputBuffer, 03419 &InputEvent, 03420 1 03421 ); 03422 #if DBG 03423 if (EventsWritten != 1) { 03424 OutputDebugStringA("PutInputInBuffer: EventsWritten != 1, 1 expected\n"); 03425 } 03426 #endif 03427 }

BOOL HandleMouseEvent IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo,
IN UINT  Message,
IN WPARAM  wParam,
IN LPARAM  lParam
 

Definition at line 3080 of file ntcon/server/input.c.

References ASSERT, _ROW::CharRow, _CHAR_ROW::Chars, CONSOLE_HAS_FOCUS, CONSOLE_IGNORE_NEXT_MOUSE_INPUT, CONSOLE_MOUSE_DOWN, CONSOLE_MOUSE_SELECTION, CONSOLE_QUICK_EDIT_MODE, CONSOLE_SELECTING, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_TEXTMODE_BUFFER, ConvertMouseButtonState(), ConvertToMouseSelect(), DoCopy(), DoPaste(), ExtendSelection(), FALSE, GetControlKeyState(), GetKeyState(), gfTrimLeadingZeros, IS_WORD_DELIM, KEY_PRESSED, L, msgSelectMode, MyInvert(), ReleaseCapture(), SCR_FONTSIZE(), SetCapture, SetWinText(), SHORT, TRUE, UINT, UpdateMousePosition(), and WriteInputBuffer().

Referenced by ConsoleWindowProc().

03093 { 03094 ULONG ButtonFlags,EventFlags; 03095 INPUT_RECORD InputEvent; 03096 ULONG EventsWritten; 03097 COORD MousePosition; 03098 SHORT RowIndex; 03099 PROW Row; 03100 03101 if (!(Console->Flags & CONSOLE_HAS_FOCUS) && 03102 !(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) && 03103 !(Console->SelectionFlags & CONSOLE_MOUSE_DOWN)) { 03104 return TRUE; 03105 } 03106 03107 if (Console->Flags & CONSOLE_IGNORE_NEXT_MOUSE_INPUT) { 03108 // only reset on up transition 03109 if (Message != WM_LBUTTONDOWN && 03110 Message != WM_MBUTTONDOWN && 03111 Message != WM_RBUTTONDOWN) { 03112 Console->Flags &= ~CONSOLE_IGNORE_NEXT_MOUSE_INPUT; 03113 return FALSE; 03114 } 03115 return TRUE; 03116 } 03117 03118 // 03119 // translate mouse position into characters, if necessary. 03120 // 03121 03122 MousePosition.X = LOWORD(lParam); 03123 MousePosition.Y = HIWORD(lParam); 03124 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 03125 MousePosition.X /= SCR_FONTSIZE(ScreenInfo).X; 03126 MousePosition.Y /= SCR_FONTSIZE(ScreenInfo).Y; 03127 } 03128 MousePosition.X += ScreenInfo->Window.Left; 03129 MousePosition.Y += ScreenInfo->Window.Top; 03130 03131 // 03132 // make sure mouse position is clipped to screen buffer 03133 // 03134 03135 if (MousePosition.X < 0) { 03136 MousePosition.X = 0; 03137 } else if (MousePosition.X >= ScreenInfo->ScreenBufferSize.X) { 03138 MousePosition.X = ScreenInfo->ScreenBufferSize.X-1; 03139 } 03140 if (MousePosition.Y < 0) { 03141 MousePosition.Y = 0; 03142 } else if (MousePosition.Y >= ScreenInfo->ScreenBufferSize.Y) { 03143 MousePosition.Y = ScreenInfo->ScreenBufferSize.Y-1; 03144 } 03145 03146 if (Console->Flags & CONSOLE_SELECTING || 03147 ((Console->Flags & CONSOLE_QUICK_EDIT_MODE) && 03148 (Console->FullScreenFlags == 0)) ) { 03149 if (Message == WM_LBUTTONDOWN) { 03150 03151 // 03152 // make sure message matches button state 03153 // 03154 03155 if (!(GetKeyState(VK_LBUTTON) & KEY_PRESSED)) { 03156 return FALSE; 03157 } 03158 03159 if (Console->Flags & CONSOLE_QUICK_EDIT_MODE && 03160 !(Console->Flags & CONSOLE_SELECTING)) { 03161 Console->Flags |= CONSOLE_SELECTING; 03162 Console->SelectionFlags = CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN | CONSOLE_SELECTION_NOT_EMPTY; 03163 03164 // 03165 // invert selection 03166 // 03167 03168 Console->SelectionAnchor = MousePosition; 03169 Console->SelectionRect.Left =Console->SelectionRect.Right = Console->SelectionAnchor.X; 03170 Console->SelectionRect.Top = Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 03171 MyInvert(Console,&Console->SelectionRect); 03172 SetWinText(Console,msgSelectMode,TRUE); 03173 SetCapture(Console->hWnd); 03174 } else { 03175 03176 // 03177 // We now capture the mouse to our Window. We do this so that the user can 03178 // "scroll" the selection endpoint to an off screen position by moving the 03179 // mouse off the client area. 03180 // 03181 03182 if (Console->SelectionFlags & CONSOLE_MOUSE_SELECTION) { 03183 03184 // 03185 // Check for SHIFT-Mouse Down "continue previous selection" command 03186 // 03187 03188 if (GetKeyState(VK_SHIFT) & KEY_PRESSED) { 03189 Console->SelectionFlags |= CONSOLE_MOUSE_DOWN; // BUGBUG necessary flag? 03190 SetCapture(Console->hWnd); 03191 ExtendSelection(Console, 03192 MousePosition 03193 ); 03194 } else { 03195 03196 // 03197 // invert old selection, reset anchor, and invert 03198 // new selection. 03199 // 03200 03201 MyInvert(Console,&Console->SelectionRect); 03202 Console->SelectionFlags |= CONSOLE_MOUSE_DOWN; // BUGBUG necessary flag? 03203 SetCapture(Console->hWnd); 03204 Console->SelectionAnchor = MousePosition; 03205 Console->SelectionRect.Left =Console->SelectionRect.Right = Console->SelectionAnchor.X; 03206 Console->SelectionRect.Top = Console->SelectionRect.Bottom = Console->SelectionAnchor.Y; 03207 MyInvert(Console,&Console->SelectionRect); 03208 } 03209 } else { 03210 ConvertToMouseSelect(Console, 03211 MousePosition 03212 ); 03213 } 03214 } 03215 } else if (Message == WM_LBUTTONUP) { 03216 if (Console->SelectionFlags & CONSOLE_MOUSE_SELECTION) { 03217 Console->SelectionFlags &= ~CONSOLE_MOUSE_DOWN; 03218 ReleaseCapture(); 03219 } 03220 } else if (Message == WM_LBUTTONDBLCLK) { 03221 if ((MousePosition.X == Console->SelectionAnchor.X) && 03222 (MousePosition.Y == Console->SelectionAnchor.Y)) { 03223 RowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+MousePosition.Y) % ScreenInfo->ScreenBufferSize.Y; 03224 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 03225 while (Console->SelectionAnchor.X > 0) { 03226 if (IS_WORD_DELIM(Row->CharRow.Chars[Console->SelectionAnchor.X - 1])) 03227 break; 03228 Console->SelectionAnchor.X--; 03229 } 03230 while (MousePosition.X < ScreenInfo->ScreenBufferSize.X) { 03231 if (IS_WORD_DELIM(Row->CharRow.Chars[MousePosition.X])) 03232 break; 03233 MousePosition.X++; 03234 } 03235 if (gfTrimLeadingZeros) { 03236 // 03237 // Trim the leading zeros: 000fe12 -> fe12 03238 // Usefull for debugging 03239 // 03240 if (MousePosition.X > Console->SelectionAnchor.X + 2 && 03241 Row->CharRow.Chars[Console->SelectionAnchor.X + 1] != L'x' && 03242 Row->CharRow.Chars[Console->SelectionAnchor.X + 1] != L'X') { 03243 // Don't touch the selection begins with 0x 03244 while (Row->CharRow.Chars[Console->SelectionAnchor.X] == L'0' && Console->SelectionAnchor.X < MousePosition.X - 1) { 03245 Console->SelectionAnchor.X++; 03246 } 03247 } 03248 } 03249 ExtendSelection(Console, MousePosition); 03250 } 03251 } else if ((Message == WM_RBUTTONDOWN) || (Message == WM_RBUTTONDBLCLK)) { 03252 if (!(Console->SelectionFlags & CONSOLE_MOUSE_DOWN)) { 03253 if (Console->Flags & CONSOLE_SELECTING) { 03254 DoCopy(Console); 03255 } else if (Console->Flags & CONSOLE_QUICK_EDIT_MODE) { 03256 DoPaste(Console); 03257 } 03258 Console->Flags |= CONSOLE_IGNORE_NEXT_MOUSE_INPUT; 03259 } 03260 } else if (Message == WM_MOUSEMOVE) { 03261 if (Console->SelectionFlags & CONSOLE_MOUSE_DOWN) { 03262 ExtendSelection(Console, 03263 MousePosition 03264 ); 03265 } 03266 } else if (Message == WM_MOUSEWHEEL) { 03267 return TRUE; 03268 } 03269 return FALSE; 03270 } 03271 03272 if (!(Console->InputBuffer.InputMode & ENABLE_MOUSE_INPUT)) { 03273 ReleaseCapture(); 03274 if (Console->FullScreenFlags == 0) { 03275 return TRUE; 03276 } 03277 return FALSE; 03278 } 03279 03280 // BUGBUG alt is not set correctly 03281 InputEvent.Event.MouseEvent.dwControlKeyState = GetControlKeyState(0); 03282 03283 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 03284 if (MousePosition.X > ScreenInfo->Window.Right) { 03285 MousePosition.X = ScreenInfo->Window.Right; 03286 } 03287 if (MousePosition.Y > ScreenInfo->Window.Bottom) { 03288 MousePosition.Y = ScreenInfo->Window.Bottom; 03289 } 03290 } 03291 switch (Message) { 03292 case WM_LBUTTONDOWN: 03293 SetCapture(Console->hWnd); 03294 ButtonFlags = FROM_LEFT_1ST_BUTTON_PRESSED; 03295 EventFlags = 0; 03296 break; 03297 case WM_LBUTTONUP: 03298 ReleaseCapture(); 03299 ButtonFlags = 0; 03300 EventFlags = 0; 03301 break; 03302 case WM_RBUTTONDOWN: 03303 SetCapture(Console->hWnd); 03304 ButtonFlags = RIGHTMOST_BUTTON_PRESSED; 03305 EventFlags = 0; 03306 break; 03307 case WM_RBUTTONUP: 03308 ReleaseCapture(); 03309 ButtonFlags = 0; 03310 EventFlags = 0; 03311 break; 03312 case WM_MBUTTONDOWN: 03313 SetCapture(Console->hWnd); 03314 ButtonFlags = FROM_LEFT_2ND_BUTTON_PRESSED; 03315 EventFlags = 0; 03316 break; 03317 case WM_MBUTTONUP: 03318 ReleaseCapture(); 03319 ButtonFlags = 0; 03320 EventFlags = 0; 03321 break; 03322 case WM_MOUSEMOVE: 03323 ButtonFlags = 0; 03324 EventFlags = MOUSE_MOVED; 03325 break; 03326 case WM_LBUTTONDBLCLK: 03327 ButtonFlags = FROM_LEFT_1ST_BUTTON_PRESSED; 03328 EventFlags = DOUBLE_CLICK; 03329 break; 03330 case WM_RBUTTONDBLCLK: 03331 ButtonFlags = RIGHTMOST_BUTTON_PRESSED; 03332 EventFlags = DOUBLE_CLICK; 03333 break; 03334 case WM_MBUTTONDBLCLK: 03335 ButtonFlags = FROM_LEFT_2ND_BUTTON_PRESSED; 03336 EventFlags = DOUBLE_CLICK; 03337 break; 03338 case WM_MOUSEWHEEL: 03339 ButtonFlags = ((UINT)wParam & 0xFFFF0000); 03340 EventFlags = MOUSE_WHEELED; 03341 break; 03342 default: 03343 ASSERT(FALSE); 03344 } 03345 InputEvent.EventType = MOUSE_EVENT; 03346 InputEvent.Event.MouseEvent.dwMousePosition = MousePosition; 03347 InputEvent.Event.MouseEvent.dwEventFlags = EventFlags; 03348 InputEvent.Event.MouseEvent.dwButtonState = 03349 ConvertMouseButtonState(ButtonFlags,(UINT)wParam); 03350 EventsWritten = WriteInputBuffer( Console, 03351 &Console->InputBuffer, 03352 &InputEvent, 03353 1 03354 ); 03355 #if DBG 03356 if (EventsWritten != 1) { 03357 OutputDebugStringA("PutInputInBuffer: EventsWritten != 1, 1 expected\n"); 03358 } 03359 #endif 03360 #ifdef i386 03361 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 03362 UpdateMousePosition(ScreenInfo,InputEvent.Event.MouseEvent.dwMousePosition); 03363 } 03364 #endif 03365 return FALSE; 03366 }

BOOL HandleSysKeyEvent IN PCONSOLE_INFORMATION  Console,
IN HWND  hWnd,
IN UINT  Message,
IN WPARAM  wParam,
IN LPARAM  lParam
 

Definition at line 2272 of file ntcon/server/input.c.

References BOOL, ChangeDispSettings(), CONIME_KEYDATA, ConvertToFullScreen(), ConvertToWindowed(), FALSE, FullScreenInitialized, GetKeyState(), ghInstance, HandleKeyEvent(), hWnd, KEY_PRESSED, KEY_UP_TRANSITION, L, LOBYTE, MapVirtualKey(), msgNoFullScreen, ShowWindow, and TRUE.

Referenced by ConsoleWindowProc().

02286 { 02287 WORD VirtualKeyCode; 02288 BOOL bCtrlDown; 02289 02290 #if defined (FE_IME) 02291 // Sep.16.1995 Support Console IME by v-HirShi(Hirotoshi Shimizu) 02292 if (Message == WM_SYSCHAR || Message == WM_SYSDEADCHAR || 02293 Message == WM_SYSCHAR+CONIME_KEYDATA || Message == WM_SYSDEADCHAR+CONIME_KEYDATA) 02294 #else 02295 if (Message == WM_SYSCHAR || Message == WM_SYSDEADCHAR) 02296 #endif 02297 { 02298 VirtualKeyCode = (WORD)MapVirtualKey(LOBYTE(HIWORD(lParam)), 1); 02299 } else { 02300 VirtualKeyCode = LOWORD(wParam); 02301 } 02302 02303 // 02304 // check for ctrl-esc 02305 // 02306 bCtrlDown = GetKeyState(VK_CONTROL) & KEY_PRESSED; 02307 02308 if (VirtualKeyCode == VK_ESCAPE && 02309 bCtrlDown && 02310 !(GetKeyState(VK_MENU) & KEY_PRESSED) && 02311 !(GetKeyState(VK_SHIFT) & KEY_PRESSED) && 02312 !(Console->ReserveKeys & CONSOLE_CTRLESC) ) { 02313 return TRUE; // call DefWindowProc 02314 } 02315 02316 if ((lParam & 0x20000000) == 0) { // we're iconic 02317 02318 02319 // 02320 // Check for ENTER while ICONic (Restore accelerator) 02321 // 02322 02323 if (VirtualKeyCode == VK_RETURN && !(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)) { 02324 02325 return TRUE; // call DefWindowProc 02326 } else { 02327 HandleKeyEvent(Console, 02328 hWnd, 02329 Message, 02330 wParam, 02331 lParam 02332 ); 02333 return FALSE; 02334 } 02335 } 02336 02337 if (VirtualKeyCode == VK_RETURN && !bCtrlDown && 02338 !(Console->ReserveKeys & CONSOLE_ALTENTER)) { 02339 #ifdef i386 02340 if (!(Message & KEY_UP_TRANSITION)) { 02341 if (FullScreenInitialized) { 02342 if (Console->FullScreenFlags == 0) { 02343 ConvertToFullScreen(Console); 02344 Console->FullScreenFlags = CONSOLE_FULLSCREEN; 02345 02346 ChangeDispSettings(Console, Console->hWnd,CDS_FULLSCREEN); 02347 } else { 02348 ConvertToWindowed(Console); 02349 Console->FullScreenFlags &= ~CONSOLE_FULLSCREEN; 02350 02351 ChangeDispSettings(Console, Console->hWnd,0); 02352 02353 ShowWindow(Console->hWnd, SW_RESTORE); 02354 } 02355 } else { 02356 WCHAR ItemString[70]; 02357 LoadString(ghInstance,msgNoFullScreen,ItemString,70); 02358 MessageBoxEx(Console->hWnd, 02359 ItemString, 02360 Console->Title, 02361 MB_SYSTEMMODAL | MB_OK, 02362 0L 02363 ); 02364 } 02365 } 02366 #endif 02367 return FALSE; 02368 } 02369 02370 // 02371 // make sure alt-space gets translated so that the system 02372 // menu is displayed. 02373 // 02374 02375 if (!(GetKeyState(VK_CONTROL) & KEY_PRESSED)) { 02376 if (VirtualKeyCode == VK_SPACE && !(Console->ReserveKeys & CONSOLE_ALTSPACE)) { 02377 return TRUE; // call DefWindowProc 02378 } 02379 02380 if (VirtualKeyCode == VK_ESCAPE && !(Console->ReserveKeys & CONSOLE_ALTESC)) { 02381 return TRUE; // call DefWindowProc 02382 } 02383 if (VirtualKeyCode == VK_TAB && !(Console->ReserveKeys & CONSOLE_ALTTAB)) { 02384 return TRUE; // call DefWindowProc 02385 } 02386 } 02387 HandleKeyEvent(Console, 02388 hWnd, 02389 Message, 02390 wParam, 02391 lParam 02392 ); 02393 return FALSE; 02394 }

VOID HorizontalScroll IN PSCREEN_INFORMATION  ScreenInfo,
IN WORD  ScrollCommand,
IN WORD  AbsoluteChange
 

Definition at line 4653 of file output.c.

References CONSOLE_WINDOW_SIZE_X, max, min, SetWindowOrigin(), SHORT, and TRUE.

Referenced by ConsoleWindowProc(), and HandleKeyEvent().

04658 { 04659 COORD NewOrigin; 04660 04661 NewOrigin.X = ScreenInfo->Window.Left; 04662 NewOrigin.Y = ScreenInfo->Window.Top; 04663 switch (ScrollCommand) { 04664 case SB_LINEUP: 04665 NewOrigin.X--; 04666 break; 04667 case SB_LINEDOWN: 04668 NewOrigin.X++; 04669 break; 04670 case SB_PAGEUP: 04671 NewOrigin.X-=CONSOLE_WINDOW_SIZE_X(ScreenInfo)-1; 04672 break; 04673 case SB_PAGEDOWN: 04674 NewOrigin.X+=CONSOLE_WINDOW_SIZE_X(ScreenInfo)-1; 04675 break; 04676 case SB_THUMBTRACK: 04677 case SB_THUMBPOSITION: 04678 NewOrigin.X= AbsoluteChange; 04679 break; 04680 case SB_TOP: 04681 NewOrigin.X=0; 04682 break; 04683 case SB_BOTTOM: 04684 NewOrigin.X=(WORD)(ScreenInfo->ScreenBufferSize.X-CONSOLE_WINDOW_SIZE_X(ScreenInfo)); 04685 break; 04686 04687 default: 04688 return; 04689 } 04690 04691 NewOrigin.X = (WORD)(max(0,min((SHORT)NewOrigin.X, 04692 (SHORT)ScreenInfo->ScreenBufferSize.X-(SHORT)CONSOLE_WINDOW_SIZE_X(ScreenInfo)))); 04693 SetWindowOrigin(ScreenInfo, 04694 (BOOLEAN)TRUE, 04695 NewOrigin 04696 ); 04697 }

VOID InitializeConsoleAttributes VOID   ) 
 

Definition at line 2132 of file srvinit.c.

02136 : 02137 02138 This routine initializes default attributes from the current 02139 user's registry values. It gets called during logon/logoff. 02140 02141 Arguments: 02142 02143 none 02144 02145 Return Value: 02146 02147 none 02148 02149 --*/ 02150 02151 { 02152 // 02153 // Store default values in structure and mark it 02154 // as invalid (by resetting LastWriteTime). 02155 // 02156 02157 DefaultRegInfo.ScreenFill.Attributes = 0x07; // white on black 02158 DefaultRegInfo.ScreenFill.Char.UnicodeChar = (WCHAR)' '; 02159 DefaultRegInfo.PopupFill.Attributes = 0xf5; // purple on white 02160 DefaultRegInfo.PopupFill.Char.UnicodeChar = (WCHAR)' '; 02161 DefaultRegInfo.InsertMode = FALSE; 02162 DefaultRegInfo.QuickEdit = FALSE; 02163 DefaultRegInfo.AutoPosition = TRUE; 02164 DefaultRegInfo.FullScreen = FALSE; 02165 DefaultRegInfo.ScreenBufferSize.X = 80; 02166 DefaultRegInfo.ScreenBufferSize.Y = 25; 02167 DefaultRegInfo.WindowSize.X = 80; 02168 DefaultRegInfo.WindowSize.Y = 25; 02169 DefaultRegInfo.WindowOrigin.X = 0; 02170 DefaultRegInfo.WindowOrigin.Y = 0; 02171 DefaultRegInfo.FontSize.X = 0; 02172 DefaultRegInfo.FontSize.Y = 0; 02173 DefaultRegInfo.FontFamily = 0; 02174 DefaultRegInfo.FontWeight = 0; 02175 DefaultRegInfo.FaceName[0] = L'\0'; 02176 DefaultRegInfo.CursorSize = CURSOR_SMALL_SIZE; 02177 DefaultRegInfo.HistoryBufferSize = DEFAULT_NUMBER_OF_COMMANDS; 02178 DefaultRegInfo.NumberOfHistoryBuffers = DEFAULT_NUMBER_OF_BUFFERS; 02179 DefaultRegInfo.HistoryNoDup = FALSE; 02180 DefaultRegInfo.ColorTable[ 0] = RGB(0, 0, 0 ); 02181 DefaultRegInfo.ColorTable[ 1] = RGB(0, 0, 0x80); 02182 DefaultRegInfo.ColorTable[ 2] = RGB(0, 0x80,0 ); 02183 DefaultRegInfo.ColorTable[ 3] = RGB(0, 0x80,0x80); 02184 DefaultRegInfo.ColorTable[ 4] = RGB(0x80,0, 0 ); 02185 DefaultRegInfo.ColorTable[ 5] = RGB(0x80,0, 0x80); 02186 DefaultRegInfo.ColorTable[ 6] = RGB(0x80,0x80,0 ); 02187 DefaultRegInfo.ColorTable[ 7] = RGB(0xC0,0xC0,0xC0); 02188 DefaultRegInfo.ColorTable[ 8] = RGB(0x80,0x80,0x80); 02189 DefaultRegInfo.ColorTable[ 9] = RGB(0, 0, 0xFF); 02190 DefaultRegInfo.ColorTable[10] = RGB(0, 0xFF,0 ); 02191 DefaultRegInfo.ColorTable[11] = RGB(0, 0xFF,0xFF); 02192 DefaultRegInfo.ColorTable[12] = RGB(0xFF,0, 0 ); 02193 DefaultRegInfo.ColorTable[13] = RGB(0xFF,0, 0xFF); 02194 DefaultRegInfo.ColorTable[14] = RGB(0xFF,0xFF,0 ); 02195 DefaultRegInfo.ColorTable[15] = RGB(0xFF,0xFF,0xFF); 02196 #if defined(FE_SB) // scotthsu 02197 DefaultRegInfo.CodePage = OEMCP; 02198 #endif 02199 DefaultRegInfo.LastWriteTime = 0; 02200 02201 // 02202 // Get system metrics for this user 02203 // 02204 02205 InitializeSystemMetrics(); 02206 }

VOID InitializeConsoleCommandData IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 4700 of file server/cmdline.c.

Referenced by AllocateConsole().

04706 : 04707 04708 This routine initializes the per-console commandline recall data structures. 04709 04710 Arguments: 04711 04712 Console - pointer to console. 04713 04714 Return Value: 04715 04716 none 04717 04718 --*/ 04719 04720 { 04721 Console->NumCommandHistories = 0; 04722 InitializeListHead(&Console->CommandHistoryList); 04723 }

NTSTATUS InitializeConsoleHandleTable VOID   ) 
 

Definition at line 57 of file w32/ntcon/server/handle.c.

References ConsoleHandleLock, ConsoleHandles, InitialConsoleHandles, NELEM, NTSTATUS(), NumberOfConsoleHandles, RtlInitializeCriticalSectionAndSpinCount(), and Status.

Referenced by ConServerDllInitialization().

00061 : 00062 00063 This routine initializes the global console handle table. 00064 00065 Arguments: 00066 00067 none. 00068 00069 Return Value: 00070 00071 none. 00072 00073 --*/ 00074 00075 { 00076 NTSTATUS Status; 00077 00078 Status = RtlInitializeCriticalSectionAndSpinCount(&ConsoleHandleLock, 00079 0x80000000); 00080 00081 RtlZeroMemory(InitialConsoleHandles, sizeof(InitialConsoleHandles)); 00082 ConsoleHandles = InitialConsoleHandles; 00083 NumberOfConsoleHandles = NELEM(InitialConsoleHandles); 00084 00085 return Status; 00086 }

BOOL InitializeCustomCP VOID   ) 
 

VOID InitializeFonts VOID   ) 
 

Definition at line 109 of file w32/ntcon/server/misc.c.

References CONSOLE_MAX_FONT_NAME_LENGTH, L, NELEM, and NULL.

Referenced by ConServerDllInitialization().

00110 { 00111 WCHAR FontName[CONSOLE_MAX_FONT_NAME_LENGTH]; 00112 int i; 00113 static CONST LPWSTR FontList[] = {L"woafont", 00114 L"ega80woa.fon", 00115 L"ega40woa.fon", 00116 L"cga80woa.fon", 00117 L"cga40woa.fon"}; 00118 00119 // 00120 // Read software.ini to get the values for "woafont", 00121 // "ega80woa.fon", "ega40woa.fon", "cga80woa.fon", and 00122 // "cga40woa.fon", respectively, to pass to AddFontResource. 00123 // 00124 // If any of the entries are empty or non-existent, 00125 // GetPrivateProfileString will return a NULL (empty) string. 00126 // If such is the case, the call to AddPermanentFontResource will 00127 // simply fail. 00128 // 00129 00130 OpenProfileUserMapping(); 00131 00132 for (i = 0; i < NELEM(FontList); i++) { 00133 GetPrivateProfileString(L"386enh", FontList[i], L"", 00134 FontName, NELEM(FontName), L"system.ini"); 00135 GdiAddFontResourceW(FontName, AFRW_ADD_LOCAL_FONT,NULL); 00136 } 00137 00138 CloseProfileUserMapping(); 00139 }

BOOL InitializeFullScreen VOID   ) 
 

Definition at line 2089 of file server/private.c.

References CHAR, CONSOLE_EGACPI, CONSOLE_EGACPI_LENGTH, CONSOLE_WINDOWS_DIR_LENGTH, DBGCHARS, DWORD, FALSE, FS_MODE_FIND, FS_MODE_GRAPHICS, FS_MODE_TEXT, hCPIFile, Index, L, _MODE_FONT_PAIR::Mode, NT_SUCCESS, NtUserEnumDisplaySettings(), NULL, NUMBER_OF_MODE_FONT_PAIRS, OPEN_EXISTING, RegModeFontPairs, _MODE_FONT_PAIR::Resolution, RtlInitUnicodeString(), SHORT, TRUE, and UINT.

Referenced by InitWindowsStuff().

02090 { 02091 UNICODE_STRING vgaString; 02092 DEVMODEW devmode; 02093 ULONG i; 02094 #if !defined(FE_SB) 02095 BOOLEAN mode1 = FALSE; 02096 BOOLEAN mode2 = FALSE; 02097 #else 02098 DWORD mode1 = 0; 02099 DWORD mode2 = 0; 02100 #endif 02101 02102 CHAR WindowsDir[CONSOLE_WINDOWS_DIR_LENGTH+CONSOLE_EGACPI_LENGTH]; 02103 UINT WindowsDirLength; 02104 02105 // 02106 // query number of available modes 02107 // 02108 02109 ZeroMemory(&devmode, sizeof(DEVMODEW)); 02110 devmode.dmSize = sizeof(DEVMODEW); 02111 02112 RtlInitUnicodeString(&vgaString, L"VGACOMPATIBLE"); 02113 02114 DBGCHARS(("Number of modes = %d\n", NUMBER_OF_MODE_FONT_PAIRS)); 02115 02116 for (i=0; ; i++) 02117 { 02118 DBGCHARS(("EnumDisplaySettings %d\n", i)); 02119 02120 if (!(NT_SUCCESS(NtUserEnumDisplaySettings(&vgaString, 02121 i, 02122 &devmode, 02123 0)))) 02124 { 02125 break; 02126 } 02127 02128 #if defined(FE_SB) 02129 { 02130 ULONG Index; 02131 02132 DBGCHARS(("Mode X = %d, Y = %d\n", 02133 devmode.dmPelsWidth, devmode.dmPelsHeight)); 02134 02135 for (Index=0;Index<NUMBER_OF_MODE_FONT_PAIRS;Index++) 02136 { 02137 if ((SHORT)devmode.dmPelsWidth == RegModeFontPairs[Index].Resolution.X && 02138 (SHORT)devmode.dmPelsHeight == RegModeFontPairs[Index].Resolution.Y ) 02139 { 02140 if (devmode.dmDisplayFlags & DMDISPLAYFLAGS_TEXTMODE) 02141 { 02142 if (RegModeFontPairs[Index].Mode & FS_MODE_TEXT) 02143 { 02144 RegModeFontPairs[Index].Mode |= FS_MODE_FIND; 02145 mode1++; 02146 } 02147 } 02148 else 02149 { 02150 if (RegModeFontPairs[Index].Mode & FS_MODE_GRAPHICS) 02151 { 02152 RegModeFontPairs[Index].Mode |= FS_MODE_FIND; 02153 mode2++; 02154 } 02155 } 02156 } 02157 } 02158 02159 DBGCHARS(("mode1 = %d, mode2 = %d\n", mode1, mode2)); 02160 } 02161 #else 02162 02163 if (devmode.dmPelsWidth == 720 && 02164 devmode.dmPelsHeight == 400) 02165 { 02166 mode1 = TRUE; 02167 } 02168 if (devmode.dmPelsWidth == 640 && 02169 devmode.dmPelsHeight == 350) 02170 { 02171 mode2 = TRUE; 02172 } 02173 #endif 02174 } 02175 02176 #if !defined(FE_SB) 02177 if (!(mode1 && mode2)) 02178 #else 02179 if (mode1 < 2) 02180 #endif 02181 { 02182 // 02183 // One of the modes we expected to get was not returned. 02184 // lets just fail fullscreen initialization. 02185 // 02186 02187 KdPrint(("CONSRV: InitializeFullScreen Missing text mode\n")); 02188 return FALSE; 02189 } 02190 02191 #if defined(FE_SB) 02192 if (mode2 > 0) 02193 { 02194 // Can do trun graphics mode. 02195 fFullScreenGraphics = TRUE; 02196 } 02197 #endif 02198 02199 // 02200 // open ega.cpi 02201 // 02202 02203 WindowsDirLength = GetSystemDirectoryA(WindowsDir, 02204 CONSOLE_WINDOWS_DIR_LENGTH); 02205 if (WindowsDirLength == 0) 02206 { 02207 KdPrint(("CONSRV: InitializeFullScreen Finding Font file failed\n")); 02208 return FALSE; 02209 } 02210 02211 RtlCopyMemory(&WindowsDir[WindowsDirLength], 02212 CONSOLE_EGACPI, 02213 CONSOLE_EGACPI_LENGTH); 02214 02215 if ((hCPIFile = CreateFileA(WindowsDir, 02216 GENERIC_READ, 02217 FILE_SHARE_READ, 02218 NULL, 02219 OPEN_EXISTING, 02220 0, 02221 NULL)) == (HANDLE)-1) 02222 { 02223 KdPrint(("CONSRV: InitializeFullScreen Opening Font file failed\n")); 02224 return FALSE; 02225 } 02226 02227 return TRUE; 02228 }

BOOLEAN InitializeInputHandle PHANDLE_DATA  HandleData,
PINPUT_INFORMATION  InputBuffer
 

Definition at line 1335 of file w32/ntcon/server/handle.c.

References _HANDLE_DATA::Buffer, ConsoleHeapAlloc, ConsoleHeapFree, FALSE, HANDLE_TAG, _INPUT_READ_HANDLE_DATA::InputHandleFlags, _HANDLE_DATA::InputReadData, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, _INPUT_READ_HANDLE_DATA::ReadCount, _INPUT_READ_HANDLE_DATA::ReadCountLock, RtlInitializeCriticalSection(), Status, and TRUE.

Referenced by InitializeIoHandleTable(), SrvDuplicateHandle(), and SrvOpenConsole().

01342 : 01343 01344 This routine initializes the input-specific fields of the handle data 01345 structure. 01346 01347 Arguments: 01348 01349 HandleData - Pointer to handle data structure. 01350 01351 InputBuffer - Pointer to input buffer data structure. 01352 01353 Return Value: 01354 01355 --*/ 01356 01357 { 01358 NTSTATUS Status; 01359 01360 HandleData->InputReadData = (PINPUT_READ_HANDLE_DATA)ConsoleHeapAlloc(MAKE_TAG( HANDLE_TAG ),sizeof(INPUT_READ_HANDLE_DATA)); 01361 if (!HandleData->InputReadData) { 01362 return FALSE; 01363 } 01364 Status = RtlInitializeCriticalSection(&HandleData->InputReadData->ReadCountLock); 01365 if (!NT_SUCCESS(Status)) { 01366 ConsoleHeapFree(HandleData->InputReadData); 01367 HandleData->InputReadData = NULL; 01368 return FALSE; 01369 } 01370 HandleData->InputReadData->ReadCount = 0; 01371 HandleData->InputReadData->InputHandleFlags = 0; 01372 HandleData->Buffer.InputBuffer = InputBuffer; 01373 HandleData->Buffer.InputBuffer->RefCount++; 01374 return TRUE; 01375 }

VOID InitializeMenu IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 124 of file ntcon/server/menu.c.

References cmControl, cmCopy, cmMark, cmPaste, cmScroll, CONSOLE_DISABLE_CLOSE, CONSOLE_IS_ICONIC, CONSOLE_SCROLLING, CONSOLE_SELECTING, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_TEXTMODE_BUFFER, EnableMenuItem(), IsWindow(), and NULL.

Referenced by ConsoleWindowProc().

00134 { 00135 HMENU hMenu = Console->hMenu; 00136 HMENU hHeirMenu = Console->hHeirMenu; 00137 00138 // 00139 // if we're in graphics mode, disable size menu 00140 // 00141 00142 if (!(Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER)) { 00143 EnableMenuItem(hMenu,SC_SIZE,MF_GRAYED); 00144 } 00145 00146 // 00147 // if the console is iconic, disable Mark and Scroll. 00148 // 00149 00150 if (Console->Flags & CONSOLE_IS_ICONIC) { 00151 EnableMenuItem(hHeirMenu,cmMark,MF_GRAYED); 00152 EnableMenuItem(hHeirMenu,cmScroll,MF_GRAYED); 00153 } else { 00154 00155 // 00156 // if the console is not iconic 00157 // if there are no scroll bars 00158 // or we're in mark mode 00159 // disable scroll 00160 // else 00161 // enable scroll 00162 // 00163 // if we're in scroll mode 00164 // disable mark 00165 // else 00166 // enable mark 00167 00168 if ((Console->CurrentScreenBuffer->WindowMaximizedX && 00169 Console->CurrentScreenBuffer->WindowMaximizedY) || 00170 Console->Flags & CONSOLE_SELECTING) { 00171 EnableMenuItem(hHeirMenu,cmScroll,MF_GRAYED); 00172 } else { 00173 EnableMenuItem(hHeirMenu,cmScroll,MF_ENABLED); 00174 } 00175 if (Console->Flags & CONSOLE_SCROLLING) { 00176 EnableMenuItem(hHeirMenu,cmMark,MF_GRAYED); 00177 } else { 00178 EnableMenuItem(hHeirMenu,cmMark,MF_ENABLED); 00179 } 00180 } 00181 00182 // 00183 // if we're selecting or scrolling, disable Paste. 00184 // otherwise enable it. 00185 // 00186 00187 if (Console->Flags & (CONSOLE_SELECTING | CONSOLE_SCROLLING)) { 00188 EnableMenuItem(hHeirMenu,cmPaste,MF_GRAYED); 00189 } else { 00190 EnableMenuItem(hHeirMenu,cmPaste,MF_ENABLED); 00191 } 00192 00193 // 00194 // if app has active selection, enable copy; else disabled 00195 // 00196 00197 if (Console->Flags & CONSOLE_SELECTING && 00198 Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY) { 00199 EnableMenuItem(hHeirMenu,cmCopy,MF_ENABLED); 00200 } else { 00201 EnableMenuItem(hHeirMenu,cmCopy,MF_GRAYED); 00202 } 00203 00204 // 00205 // disable close 00206 // 00207 00208 if (Console->Flags & CONSOLE_DISABLE_CLOSE) 00209 EnableMenuItem(hMenu,SC_CLOSE,MF_GRAYED); 00210 else 00211 EnableMenuItem(hMenu,SC_CLOSE,MF_ENABLED); 00212 00213 // 00214 // enable Move if not iconic 00215 // 00216 00217 if (Console->Flags & CONSOLE_IS_ICONIC) { 00218 EnableMenuItem(hMenu,SC_MOVE,MF_GRAYED); 00219 } else { 00220 EnableMenuItem(hMenu,SC_MOVE,MF_ENABLED); 00221 } 00222 00223 // 00224 // enable Settings if not already doing it 00225 // 00226 00227 if (Console->hWndProperties && IsWindow(Console->hWndProperties)) { 00228 EnableMenuItem(hMenu,cmControl,MF_GRAYED); 00229 } else { 00230 EnableMenuItem(hMenu,cmControl,MF_ENABLED); 00231 Console->hWndProperties = NULL; 00232 } 00233 }

VOID InitializeMouseButtons VOID   ) 
 

Definition at line 75 of file w32/ntcon/server/misc.c.

References GetSystemMetrics(), and NumberOfMouseButtons.

Referenced by InitializeScreenInfo().

00076 { 00077 NumberOfMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); 00078 }

VOID InitializeOutputHandle PHANDLE_DATA  HandleData,
PSCREEN_INFORMATION  ScreenBuffer
 

Definition at line 1307 of file w32/ntcon/server/handle.c.

References _HANDLE_DATA::Buffer.

Referenced by InitializeIoHandleTable(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), and SrvOpenConsole().

01314 : 01315 01316 This routine initializes the output-specific fields of the handle data 01317 structure. 01318 01319 Arguments: 01320 01321 HandleData - Pointer to handle data structure. 01322 01323 ScreenBuffer - Pointer to screen buffer data structure. 01324 01325 Return Value: 01326 01327 --*/ 01328 01329 { 01330 HandleData->Buffer.ScreenBuffer = ScreenBuffer; 01331 HandleData->Buffer.ScreenBuffer->RefCount++; 01332 }

VOID InitializeScreenInfo VOID   ) 
 

Definition at line 253 of file output.c.

References GetSystemMetrics(), InitializeMouseButtons(), InitializeSystemMetrics(), L, MinimumWidthX, NULL, and UsePolyTextOut.

Referenced by ConsoleInputThread().

00254 { 00255 HDC hDC; 00256 00257 InitializeMouseButtons(); 00258 MinimumWidthX = GetSystemMetrics(SM_CXMIN); 00259 00260 InitializeSystemMetrics(); 00261 00262 hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL); 00263 if (hDC != NULL) { 00264 UsePolyTextOut = GetDeviceCaps(hDC,TEXTCAPS) & TC_SCROLLBLT; 00265 DeleteDC(hDC); 00266 } 00267 }

NTSTATUS InitializeScrollBuffer VOID   ) 
 

Definition at line 2631 of file output.c.

References AllocateScrollBuffer(), ConsoleHeapAlloc, ConsoleHeapFree, DefaultRegInfo, ghrgnScroll, gprgnData, GRGNDATASIZE, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, RtlInitializeCriticalSectionAndSpinCount(), SCREEN_TAG, _CONSOLE_REGISTRY_INFO::ScreenBufferSize, ScrollBufferLock, and Status.

Referenced by InitWindowsStuff().

02632 { 02633 NTSTATUS Status; 02634 02635 ghrgnScroll = CreateRectRgn(0,0,1,1); 02636 if (ghrgnScroll == NULL) { 02637 RIPMSG0(RIP_WARNING, "InitializeScrollBuffer: cannot allocate ghrgnScroll."); 02638 return STATUS_UNSUCCESSFUL; 02639 } 02640 gprgnData = (LPRGNDATA)ConsoleHeapAlloc(MAKE_TAG( SCREEN_TAG ),GRGNDATASIZE); 02641 if (gprgnData == NULL) { 02642 RIPMSG0(RIP_WARNING, "InitializeScrollBuffer: allocate gprgnData."); 02643 Status = STATUS_NO_MEMORY; 02644 goto error; 02645 } 02646 02647 Status = AllocateScrollBuffer(DefaultRegInfo.ScreenBufferSize.X * 02648 DefaultRegInfo.ScreenBufferSize.Y * 02649 sizeof(CHAR_INFO)); 02650 if (!NT_SUCCESS(Status)) { 02651 goto error; 02652 } 02653 02654 Status = RtlInitializeCriticalSectionAndSpinCount(&ScrollBufferLock, 02655 0x80000000); 02656 02657 error: 02658 if (!NT_SUCCESS(Status)) { 02659 RIPMSG0(RIP_WARNING, "InitializeScrollBuffer failed, cleaning up"); 02660 if (ghrgnScroll) { 02661 DeleteObject(ghrgnScroll); 02662 ghrgnScroll = NULL; 02663 } 02664 if (gprgnData) { 02665 ConsoleHeapFree(gprgnData); 02666 gprgnData = NULL; 02667 } 02668 } 02669 02670 return Status; 02671 }

VOID InitializeSubst VOID   ) 
 

VOID InitializeSystemMetrics VOID   ) 
 

Definition at line 177 of file output.c.

References AdjustWindowRectEx(), CONSOLE_WINDOW_EX_FLAGS, CONSOLE_WINDOW_FLAGS, ConsoleCaptionY, ConsoleFullScreenX, ConsoleFullScreenY, FALSE, GetSystemMetrics(), gfInitSystemMetrics, guCaretBlinkTime, gucWheelScrollLines, HorizontalClientToWindow, HorizontalScrollSize, SHORT, SystemParametersInfo(), VerticalClientToWindow, and VerticalScrollSize.

Referenced by ConsoleWindowProc(), GetWindowLimits(), InitializeConsoleAttributes(), InitializeScreenInfo(), InternalSetWindowSize(), and ProcessResizeWindow().

00178 { 00179 RECT WindowSize; 00180 00181 gfInitSystemMetrics = FALSE; 00182 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &gucWheelScrollLines, FALSE); 00183 ConsoleFullScreenX = GetSystemMetrics(SM_CXFULLSCREEN); 00184 ConsoleFullScreenY = GetSystemMetrics(SM_CYFULLSCREEN); 00185 ConsoleCaptionY = GetSystemMetrics(SM_CYCAPTION); 00186 VerticalScrollSize = (SHORT)GetSystemMetrics(SM_CXVSCROLL); 00187 HorizontalScrollSize = (SHORT)GetSystemMetrics(SM_CYHSCROLL); 00188 WindowSize.left = WindowSize.top = 0; 00189 WindowSize.right = WindowSize.bottom = 50; 00190 AdjustWindowRectEx(&WindowSize, 00191 CONSOLE_WINDOW_FLAGS, 00192 FALSE, 00193 CONSOLE_WINDOW_EX_FLAGS 00194 ); 00195 VerticalClientToWindow = (SHORT)(WindowSize.right-WindowSize.left-50); 00196 HorizontalClientToWindow = (SHORT)(WindowSize.bottom-WindowSize.top-50); 00197 00198 #ifdef LATER 00199 gfIsIMEEnabled = !!GetSystemMetrics(SM_IMMENABLED); 00200 RIPMSG1(RIP_VERBOSE, "InitializeSystemMetrics: gfIsIMEEnabled=%d", gfIsIMEEnabled); 00201 #endif 00202 00203 guCaretBlinkTime = GetCaretBlinkTime(); 00204 }

VOID InitializeThreadMessages VOID   ) 
 

VOID InitSystemMenu IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 61 of file ntcon/server/menu.c.

References AppendMenu(), cmControl, cmDefaults, cmEdit, ghInstance, ID_WOMENU, MyModifyMenuItem(), and NELEM.

Referenced by CreateWindowsWindow().

00064 { 00065 WCHAR ItemString[30]; 00066 int ItemLength; 00067 00068 // 00069 // load the clipboard menu. 00070 // 00071 00072 Console->hHeirMenu = LoadMenu(ghInstance, MAKEINTRESOURCE(ID_WOMENU)); 00073 if (Console->hHeirMenu) { 00074 ItemLength = LoadString(ghInstance,cmEdit,ItemString,NELEM(ItemString)); 00075 if (ItemLength == 0) 00076 KdPrint(("LoadString 1 failed %d\n",GetLastError())); 00077 } 00078 else 00079 KdPrint(("LoadMenu 1 failed %d\n",GetLastError())); 00080 00081 // 00082 // edit the accelerators off of the standard items. 00083 // 00084 00085 MyModifyMenuItem(Console,SC_CLOSE); 00086 00087 // 00088 // Append the clipboard menu to system menu 00089 // 00090 00091 if (!AppendMenu(Console->hMenu, 00092 MF_POPUP | MF_STRING, 00093 (ULONG_PTR)Console->hHeirMenu, 00094 //"Edit" 00095 ItemString 00096 )) { 00097 KdPrint(("AppendMenu 1 failed %d\n",GetLastError())); 00098 } 00099 00100 // 00101 // Add other items to system menu 00102 // 00103 00104 ItemLength = LoadString(ghInstance,cmDefaults,ItemString,NELEM(ItemString)); 00105 if (ItemLength == 0) 00106 KdPrint(("LoadString %d failed %d\n",cmDefaults,GetLastError())); 00107 if (ItemLength) { 00108 if (!AppendMenu(Console->hMenu, MF_STRING, cmDefaults, ItemString)) { 00109 KdPrint(("AppendMenu %d failed %d\n",cmDefaults,GetLastError())); 00110 } 00111 } 00112 ItemLength = LoadString(ghInstance,cmControl,ItemString,NELEM(ItemString)); 00113 if (ItemLength == 0) 00114 KdPrint(("LoadString %d failed %d\n",cmControl,GetLastError())); 00115 if (ItemLength) { 00116 if (!AppendMenu(Console->hMenu, MF_STRING, cmControl, ItemString)) { 00117 KdPrint(("AppendMenu %d failed %d\n",cmControl,GetLastError())); 00118 } 00119 } 00120 }

VOID InsertScreenBuffer IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo
 

Definition at line 1155 of file w32/ntcon/server/handle.c.

Referenced by SrvCreateConsoleScreenBuffer().

01162 : 01163 01164 This routine inserts the screen buffer pointer into the console's 01165 list of screen buffers. 01166 01167 Arguments: 01168 01169 Console - Pointer to console information structure. 01170 01171 ScreenInfo - Pointer to screen information structure. 01172 01173 Return Value: 01174 01175 Note: 01176 01177 The console lock must be held when calling this routine. 01178 01179 --*/ 01180 01181 { 01182 ScreenInfo->Next = Console->ScreenBuffers; 01183 Console->ScreenBuffers = ScreenInfo; 01184 }

VOID InvertSelection IN PCONSOLE_INFORMATION  Console,
BOOL  Inverting
 

Definition at line 155 of file ntcon/server/clipbrd.c.

References BOOL, CONSOLE_SELECTING, CONSOLE_SELECTION_INVERTED, CONSOLE_SELECTION_NOT_EMPTY, FALSE, MyInvert(), and TRUE.

Referenced by SetWindowOrigin(), WriteRegionToScreenBitMap(), and WWSB_WriteRegionToScreen().

00159 { 00160 BOOL Inverted; 00161 if (Console->Flags & CONSOLE_SELECTING && 00162 Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY) { 00163 Inverted = (Console->SelectionFlags & CONSOLE_SELECTION_INVERTED) ? TRUE : FALSE; 00164 if (Inverting == Inverted) { 00165 return; 00166 } 00167 if (Inverting) { 00168 Console->SelectionFlags |= CONSOLE_SELECTION_INVERTED; 00169 } else { 00170 Console->SelectionFlags &= ~CONSOLE_SELECTION_INVERTED; 00171 } 00172 MyInvert(Console,&Console->SelectionRect); 00173 } 00174 00175 }

int LoadStringExW IN HINSTANCE  hModule,
IN UINT  wID,
OUT LPWSTR  lpBuffer,
IN int  cchBufferMax,
IN WORD  wLangId
 

Definition at line 4995 of file server/cmdline.c.

References NULL, TRUE, USHORT, and UTCHAR.

05002 { 05003 HANDLE hResInfo; 05004 HANDLE hStringSeg; 05005 LPTSTR lpsz; 05006 int cch; 05007 05008 /* 05009 * Make sure the parms are valid. 05010 */ 05011 if (lpBuffer == NULL) { 05012 return 0; 05013 } 05014 05015 cch = 0; 05016 05017 /* 05018 * String Tables are broken up into 16 string segments. Find the segment 05019 * containing the string we are interested in. 05020 */ 05021 if (hResInfo = FindResourceEx(hModule, 05022 RT_STRING, 05023 (LPTSTR)((LONG)(((USHORT)wID >> 4) + 1)), 05024 wLangId)) { 05025 05026 /* 05027 * Load that segment. 05028 */ 05029 hStringSeg = LoadResource(hModule, hResInfo); 05030 05031 /* 05032 * Lock the resource. 05033 */ 05034 if (lpsz = (LPTSTR)LockResource(hStringSeg)) { 05035 05036 /* 05037 * Move past the other strings in this segment. 05038 * (16 strings in a segment -> & 0x0F) 05039 */ 05040 wID &= 0x0F; 05041 while (TRUE) { 05042 cch = *((UTCHAR *)lpsz++); // PASCAL like string count 05043 // first UTCHAR is count if TCHARs 05044 if (wID-- == 0) break; 05045 lpsz += cch; // Step to start if next string 05046 } 05047 05048 /* 05049 * chhBufferMax == 0 means return a pointer to the read-only resource buffer. 05050 */ 05051 if (cchBufferMax == 0) { 05052 *(LPTSTR *)lpBuffer = lpsz; 05053 } else { 05054 05055 /* 05056 * Account for the NULL 05057 */ 05058 cchBufferMax--; 05059 05060 /* 05061 * Don't copy more than the max allowed. 05062 */ 05063 if (cch > cchBufferMax) 05064 cch = cchBufferMax; 05065 05066 /* 05067 * Copy the string into the buffer. 05068 */ 05069 RtlCopyMemory(lpBuffer, lpsz, cch*sizeof(WCHAR)); 05070 } 05071 } 05072 } 05073 05074 /* 05075 * Append a NULL. 05076 */ 05077 if (cchBufferMax != 0) { 05078 lpBuffer[cch] = 0; 05079 } 05080 05081 return cch; 05082 }

VOID MakeCursorVisible IN PSCREEN_INFORMATION  ScreenInfo,
IN COORD  CursorPosition
 

Definition at line 2348 of file server/stream.c.

References FALSE, NT_SUCCESS, NTSTATUS(), SetWindowOrigin(), and Status.

Referenced by ExtendSelection(), HandleKeyEvent(), and WWSB_AdjustCursorPosition().

02352 { 02353 COORD WindowOrigin; 02354 NTSTATUS Status; 02355 02356 WindowOrigin.X = 0; 02357 WindowOrigin.Y = 0; 02358 if (CursorPosition.X > ScreenInfo->Window.Right) { 02359 WindowOrigin.X = CursorPosition.X - ScreenInfo->Window.Right; 02360 } 02361 else if (CursorPosition.X < ScreenInfo->Window.Left) { 02362 WindowOrigin.X = CursorPosition.X - ScreenInfo->Window.Left; 02363 } 02364 if (CursorPosition.Y > ScreenInfo->Window.Bottom) { 02365 WindowOrigin.Y = CursorPosition.Y - ScreenInfo->Window.Bottom; 02366 } 02367 else if (CursorPosition.Y < ScreenInfo->Window.Top) { 02368 WindowOrigin.Y = CursorPosition.Y - ScreenInfo->Window.Top; 02369 } 02370 if (WindowOrigin.X != 0 || WindowOrigin.Y != 0) { 02371 Status = SetWindowOrigin(ScreenInfo, 02372 FALSE, 02373 WindowOrigin 02374 ); 02375 if (!NT_SUCCESS(Status)) { 02376 return; 02377 } 02378 } 02379 }

BOOL MapHandle IN HANDLE  ClientProcessHandle,
IN HANDLE  ServerHandle,
OUT PHANDLE  ClientHandle
 

Definition at line 874 of file srvinit.c.

References FALSE.

Referenced by AllocateConsole(), ConsoleClientConnectRoutine(), and CreateConsoleBitmap().

00879 { 00880 // 00881 // map event handle into dll's handle space. 00882 // 00883 00884 return DuplicateHandle(NtCurrentProcess(), 00885 ServerHandle, 00886 ClientProcessHandle, 00887 ClientHandle, 00888 0, 00889 FALSE, 00890 DUPLICATE_SAME_ACCESS 00891 ); 00892 }

NTSTATUS MatchandCopyAlias IN PCONSOLE_INFORMATION  Console,
IN PWCHAR  Source,
IN USHORT  SourceLength,
OUT PWCHAR  TargetBuffer,
IN OUT PUSHORT  TargetLength,
IN LPWSTR  Exe,
IN USHORT  ExeLength,
OUT PDWORD  LineCount
 

Definition at line 1105 of file server/cmdline.c.

References Buffer, ConsoleHeapAlloc, ConsoleHeapFree, FindAlias(), FindExe(), MAKE_TAG, MAX_ARGS, NTSTATUS(), NULL, Status, _ALIAS::Target, _ALIAS::TargetLength, TMP_TAG, TRUE, UNICODE_CARRIAGERETURN, UNICODE_LINEFEED, and USHORT.

Referenced by CookedRead(), and ProcessCommandListInput().

01118 : 01119 01120 This routine matches the input string with an alias and copies the 01121 alias to the input buffer. 01122 01123 Arguments: 01124 01125 Source - string to match 01126 01127 SourceLength - length of Source in bytes 01128 01129 TargetBuffer - where to store matched string 01130 01131 TargetLength - on input, contains size of TargetBuffer. On output, 01132 contains length of alias stored in TargetBuffer. 01133 01134 SourceIsCommandLine - if true, source buffer is a command line, where 01135 the first blank separate token is to be check for an alias, and if 01136 it matches, replaced with the value of the alias. if false, then 01137 the source string is a null terminated alias name. 01138 01139 LineCount - aliases can contain multiple commands. $T is the command 01140 separator 01141 01142 Return Value: 01143 01144 SUCCESS - match was found and alias was copied to buffer. 01145 01146 --*/ 01147 01148 { 01149 PALIAS Alias; 01150 NTSTATUS Status = STATUS_SUCCESS; 01151 USHORT SourceUpToFirstBlank=0; // in chars 01152 PWCHAR Tmp; 01153 PEXE_ALIAS_LIST ExeAliasList; 01154 LPWSTR Args[MAX_ARGS]; 01155 USHORT ArgsLength[MAX_ARGS]; // in bytes 01156 USHORT NumSourceArgs; 01157 LPWSTR SourcePtr; 01158 USHORT ArgCount,i,j,NewTargetLength; 01159 USHORT SourceRemainderLength; // in chars 01160 PWCHAR Buffer,TargetAlias; 01161 PWCHAR TmpBuffer; 01162 01163 // 01164 // alloc of exename may have failed. 01165 // 01166 01167 if (Exe == NULL) 01168 return STATUS_UNSUCCESSFUL; 01169 01170 // 01171 // find exe 01172 // 01173 01174 ExeAliasList = FindExe(Console,Exe,ExeLength,TRUE); 01175 if (!ExeAliasList) { 01176 return STATUS_UNSUCCESSFUL; 01177 } 01178 01179 // 01180 // find first blank 01181 // 01182 01183 for (Tmp=Source,SourceUpToFirstBlank=0; 01184 *Tmp!=(WCHAR)' ' && SourceUpToFirstBlank<(USHORT)(SourceLength/sizeof(WCHAR)); 01185 Tmp++,SourceUpToFirstBlank++) ; 01186 01187 // 01188 // find char past first blank 01189 // 01190 01191 j=SourceUpToFirstBlank; 01192 while (j<(USHORT)(SourceLength/sizeof(WCHAR)) && *Tmp==(WCHAR)' ') { 01193 Tmp++; 01194 j++; 01195 } 01196 SourcePtr = Tmp; 01197 SourceRemainderLength = (USHORT)((SourceLength/sizeof(WCHAR)) - j); 01198 01199 // 01200 // find alias 01201 // 01202 01203 Alias = FindAlias(ExeAliasList,Source,(USHORT)(SourceUpToFirstBlank*sizeof(WCHAR))); 01204 if (!Alias) { 01205 return STATUS_UNSUCCESSFUL; 01206 } 01207 01208 TmpBuffer = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),*TargetLength); 01209 if (!TmpBuffer) 01210 return STATUS_NO_MEMORY; 01211 01212 // 01213 // count args in target 01214 // 01215 01216 ArgCount=0; 01217 *LineCount=1; 01218 Tmp=Alias->Target; 01219 for (i=0;(USHORT)(i+1)<(USHORT)(Alias->TargetLength/sizeof(WCHAR));i++) { 01220 if (*Tmp == (WCHAR)'$' && *(Tmp+1) >= (WCHAR)'1' && *(Tmp+1) <= (WCHAR)'9') { 01221 USHORT ArgNum = *(Tmp+1) - (WCHAR)'0'; 01222 if (ArgNum > ArgCount) { 01223 ArgCount = ArgNum; 01224 } 01225 Tmp++; 01226 i++; 01227 } else if (*Tmp == (WCHAR)'$' && *(Tmp+1) == (WCHAR)'*') { 01228 if (ArgCount==0) { 01229 ArgCount = 1; 01230 } 01231 Tmp++; 01232 i++; 01233 } 01234 Tmp++; 01235 } 01236 01237 // 01238 // package up space separated strings in source into array 01239 // of args 01240 // 01241 // 01242 01243 NumSourceArgs=0; 01244 Tmp = SourcePtr; 01245 for (i=0,j=0;i<ArgCount;i++) { 01246 if (j<SourceRemainderLength) { 01247 Args[NumSourceArgs] = Tmp; 01248 ArgsLength[NumSourceArgs] = 0; 01249 while (j++<SourceRemainderLength && *Tmp++ != (WCHAR)' ') { 01250 ArgsLength[NumSourceArgs] += sizeof(WCHAR); 01251 } 01252 while (j<SourceRemainderLength && *Tmp == (WCHAR)' ') { 01253 j++; 01254 Tmp++; 01255 } 01256 NumSourceArgs++; 01257 } else { 01258 break; 01259 } 01260 } 01261 01262 // 01263 // put together the target string 01264 // 01265 // while (target) 01266 // if ($) 01267 // if arg && arg# <= ArgCount 01268 // copy arg 01269 // else if * 01270 // copy arg 01271 // else 01272 // replace with < > etc 01273 // else 01274 // copy text up to next ' ' 01275 // 01276 01277 Buffer = TmpBuffer; 01278 NewTargetLength = 2*sizeof(WCHAR); // for CRLF 01279 TargetAlias=Alias->Target; 01280 for (i=0;i<(USHORT)(Alias->TargetLength/sizeof(WCHAR));i++) { 01281 if (NewTargetLength >= *TargetLength) { 01282 *TargetLength = NewTargetLength; 01283 Status = STATUS_BUFFER_TOO_SMALL; 01284 break; 01285 } 01286 if (*TargetAlias == (WCHAR)'$' && (USHORT)(i+1)<(USHORT)(Alias->TargetLength/sizeof(WCHAR))) { 01287 TargetAlias++; 01288 i++; 01289 if (*TargetAlias >= (WCHAR)'1' && *TargetAlias <= (WCHAR)'9') { 01290 01291 // 01292 // do numbered parameter substitution 01293 // 01294 01295 USHORT ArgNumber; 01296 01297 ArgNumber = (USHORT)(*TargetAlias - (WCHAR)'1'); 01298 if (ArgNumber < NumSourceArgs) { 01299 if ((NewTargetLength+ArgsLength[ArgNumber])<=*TargetLength) { 01300 RtlCopyMemory(Buffer,Args[ArgNumber],ArgsLength[ArgNumber]); 01301 Buffer+=ArgsLength[ArgNumber]/sizeof(WCHAR); 01302 NewTargetLength+=ArgsLength[ArgNumber]; 01303 } else { 01304 Status = STATUS_BUFFER_TOO_SMALL; 01305 break; 01306 } 01307 } 01308 } else if (*TargetAlias == (WCHAR)'*') { 01309 01310 // 01311 // do * parameter substitution 01312 // 01313 01314 if (NumSourceArgs) { 01315 if ((USHORT)(NewTargetLength+(SourceRemainderLength*sizeof(WCHAR)))<=*TargetLength) { 01316 RtlCopyMemory(Buffer,Args[0],SourceRemainderLength*sizeof(WCHAR)); 01317 Buffer+=SourceRemainderLength; 01318 NewTargetLength+=SourceRemainderLength*sizeof(WCHAR); 01319 } else { 01320 Status = STATUS_BUFFER_TOO_SMALL; 01321 break; 01322 } 01323 } 01324 } else if (*TargetAlias == (WCHAR)'l' || *TargetAlias == (WCHAR)'L') { 01325 01326 // 01327 // do < substitution 01328 // 01329 01330 *Buffer++ = (WCHAR)'<'; 01331 NewTargetLength+=sizeof(WCHAR); 01332 } else if (*TargetAlias == (WCHAR)'g' || *TargetAlias == (WCHAR)'G') { 01333 01334 // 01335 // do > substitution 01336 // 01337 01338 *Buffer++ = (WCHAR)'>'; 01339 NewTargetLength+=sizeof(WCHAR); 01340 } else if (*TargetAlias == (WCHAR)'b' || *TargetAlias == (WCHAR)'B') { 01341 01342 // 01343 // do | substitution 01344 // 01345 01346 *Buffer++ = (WCHAR)'|'; 01347 NewTargetLength+=sizeof(WCHAR); 01348 } else if (*TargetAlias == (WCHAR)'t' || *TargetAlias == (WCHAR)'T') { 01349 01350 // 01351 // do newline substitution 01352 // 01353 01354 if ((USHORT)(NewTargetLength+(sizeof(WCHAR)*2))>*TargetLength) { 01355 Status = STATUS_BUFFER_TOO_SMALL; 01356 } 01357 01358 *LineCount += 1; 01359 *Buffer++ = UNICODE_CARRIAGERETURN; 01360 *Buffer++ = UNICODE_LINEFEED; 01361 NewTargetLength+=sizeof(WCHAR)*2; 01362 } else { 01363 01364 // 01365 // copy $X 01366 // 01367 01368 *Buffer++ = (WCHAR)'$'; 01369 NewTargetLength+=sizeof(WCHAR); 01370 *Buffer++ = *TargetAlias; 01371 NewTargetLength+=sizeof(WCHAR); 01372 } 01373 TargetAlias++; 01374 } else { 01375 01376 // 01377 // copy char 01378 // 01379 01380 *Buffer++ = *TargetAlias++; 01381 NewTargetLength+=sizeof(WCHAR); 01382 } 01383 } 01384 *Buffer++ = UNICODE_CARRIAGERETURN; 01385 *Buffer++ = UNICODE_LINEFEED; 01386 RtlCopyMemory(TargetBuffer,TmpBuffer,NewTargetLength); 01387 ConsoleHeapFree(TmpBuffer); 01388 *TargetLength = NewTargetLength; 01389 return Status; 01390 }

VOID ModifyConsoleProcessFocus IN PCONSOLE_INFORMATION  Console,
IN BOOL  Foreground
 

Definition at line 4227 of file output.c.

References _CONSOLE_PROCESS_HANDLE::Process, SetProcessFocus(), and SetProcessForegroundRights().

Referenced by ConsoleWindowProc(), and DisplayModeTransition().

04231 { 04232 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 04233 PLIST_ENTRY ListHead, ListNext; 04234 04235 ListHead = &Console->ProcessHandleList; 04236 ListNext = ListHead->Flink; 04237 while (ListNext != ListHead) { 04238 ProcessHandleRecord = CONTAINING_RECORD( ListNext, CONSOLE_PROCESS_HANDLE, ListLink ); 04239 ListNext = ListNext->Flink; 04240 { 04241 SetProcessFocus(ProcessHandleRecord->Process, Foreground); 04242 SetProcessForegroundRights(ProcessHandleRecord->Process, Foreground); 04243 } 04244 } 04245 }

BOOL MyInvert IN PCONSOLE_INFORMATION  Console,
IN PSMALL_RECT  SmallRect
 

Definition at line 70 of file ntcon/server/clipbrd.c.

References BisectClipbrd(), Rect::bottom, CONSOLE_TEXTMODE_BUFFER, _SCREEN_INFORMATION::Flags, Rect::left, Rect, Rect::right, SCR_FONTSIZE(), SHORT, StringLength(), Rect::top, TRUE, and _SCREEN_INFORMATION::Window.

Referenced by CancelKeySelection(), CancelMouseSelection(), ConvertToMouseSelect(), DoSelectAll(), ExtendSelection(), FindDialogProc(), HandleKeyEvent(), HandleMouseEvent(), InvertSelection(), and StoreSelection().

00081 { 00082 RECT Rect; 00083 PSCREEN_INFORMATION ScreenInfo; 00084 #ifdef FE_SB 00085 SMALL_RECT SmallRect2; 00086 COORD TargetPoint; 00087 SHORT StringLength; 00088 #endif // FE_SB 00089 00090 ScreenInfo = Console->CurrentScreenBuffer; 00091 #ifdef FE_SB 00092 if (CONSOLE_IS_DBCS_OUTPUTCP(Console) && 00093 ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00094 for (SmallRect2.Top=SmallRect->Top; SmallRect2.Top <= SmallRect->Bottom;SmallRect2.Top++) { 00095 SmallRect2.Bottom = SmallRect2.Top; 00096 SmallRect2.Left = SmallRect->Left; 00097 SmallRect2.Right = SmallRect->Right; 00098 00099 TargetPoint.X = SmallRect2.Left; 00100 TargetPoint.Y = SmallRect2.Top; 00101 StringLength = SmallRect2.Right - SmallRect2.Left + 1; 00102 BisectClipbrd(StringLength,TargetPoint,ScreenInfo,&SmallRect2); 00103 00104 if (SmallRect2.Left <= SmallRect2.Right) { 00105 Rect.left = SmallRect2.Left-ScreenInfo->Window.Left; 00106 Rect.top = SmallRect2.Top-ScreenInfo->Window.Top; 00107 Rect.right = SmallRect2.Right+1-ScreenInfo->Window.Left; 00108 Rect.bottom = SmallRect2.Bottom+1-ScreenInfo->Window.Top; 00109 Rect.left *= SCR_FONTSIZE(ScreenInfo).X; 00110 Rect.top *= SCR_FONTSIZE(ScreenInfo).Y; 00111 Rect.right *= SCR_FONTSIZE(ScreenInfo).X; 00112 Rect.bottom *= SCR_FONTSIZE(ScreenInfo).Y; 00113 PatBlt(Console->hDC, 00114 Rect.left, 00115 Rect.top, 00116 Rect.right - Rect.left, 00117 Rect.bottom - Rect.top, 00118 DSTINVERT 00119 ); 00120 } 00121 } 00122 } else 00123 #endif // FE_SB 00124 { 00125 Rect.left = SmallRect->Left-ScreenInfo->Window.Left; 00126 Rect.top = SmallRect->Top-ScreenInfo->Window.Top; 00127 Rect.right = SmallRect->Right+1-ScreenInfo->Window.Left; 00128 Rect.bottom = SmallRect->Bottom+1-ScreenInfo->Window.Top; 00129 #ifdef FE_SB 00130 if (!CONSOLE_IS_DBCS_OUTPUTCP(Console) && 00131 ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) 00132 #else 00133 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) 00134 #endif 00135 { 00136 Rect.left *= SCR_FONTSIZE(ScreenInfo).X; 00137 Rect.top *= SCR_FONTSIZE(ScreenInfo).Y; 00138 Rect.right *= SCR_FONTSIZE(ScreenInfo).X; 00139 Rect.bottom *= SCR_FONTSIZE(ScreenInfo).Y; 00140 } 00141 00142 PatBlt(Console->hDC, 00143 Rect.left, 00144 Rect.top, 00145 Rect.right - Rect.left, 00146 Rect.bottom - Rect.top, 00147 DSTINVERT 00148 ); 00149 } 00150 00151 return(TRUE); 00152 }

int MyStringCompareW IN LPWSTR  Str1,
IN LPWSTR  Str2,
IN USHORT  Length,
IN BOOLEAN  bCaseInsensitive
 

Definition at line 369 of file server/cmdline.c.

References RtlCompareUnicodeString(), String1, and String2.

Referenced by SearchForString(), and TranslateConsoleTitle().

00375 { 00376 UNICODE_STRING String1; 00377 UNICODE_STRING String2; 00378 00379 String1.Length = Length; 00380 String1.MaximumLength = Length; 00381 String1.Buffer = Str1; 00382 String2.Length = Length; 00383 String2.MaximumLength = Length; 00384 String2.Buffer = Str2; 00385 return RtlCompareUnicodeString(&String1, 00386 &String2, 00387 bCaseInsensitive); 00388 }

DWORD PrependInputBuffer PCONSOLE_INFORMATION  Console,
PINPUT_INFORMATION  InputBufferInformation,
PINPUT_RECORD  lpBuffer,
DWORD  nLength
 

VOID PropertiesDlgShow IN PCONSOLE_INFORMATION  Console,
IN BOOL  fCurrent
 

Definition at line 287 of file ntcon/server/menu.c.

References ASSERT, _SCREEN_INFORMATION::Attributes, _SCREEN_INFORMATION::BufferInfo, CONSOLE_AUTO_POSITION, CONSOLE_HISTORY_NODUP, CONSOLE_IS_DBCS_ENABLED, CONSOLE_QUICK_EDIT_MODE, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, _SCREEN_INFORMATION::Flags, FontInfo, InternalCreateCallbackThread(), LockConsole, NT_SUCCESS, NtClose(), NtCreateSection(), NtDuplicateObject(), NtMapViewOfSection(), NTSTATUS(), NtUnmapViewOfSection(), NULL, NumberOfFonts, _SCREEN_INFORMATION::PopupAttributes, _CONSOLE_PROCESS_HANDLE::ProcessHandle, _CONSOLE_PROCESS_HANDLE::PropRoutine, SCR_FACENAME(), SCR_FAMILY(), SCR_FONTNUMBER(), SCR_FONTSIZE(), SCR_FONTWEIGHT(), _SCREEN_INFORMATION::ScreenBufferSize, _FONT_INFO::SizeWant, Status, TM_IS_TT_FONT, and UnlockConsole().

Referenced by ConsoleWindowProc().

00299 { 00300 HANDLE hSection = NULL; 00301 HANDLE hClientSection = NULL; 00302 HANDLE hThread; 00303 SIZE_T ulViewSize; 00304 LARGE_INTEGER li; 00305 NTSTATUS Status; 00306 PCONSOLE_STATE_INFO pStateInfo; 00307 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00308 PSCREEN_INFORMATION ScreenInfo; 00309 LPTHREAD_START_ROUTINE MyPropRoutine; 00310 00311 /* 00312 * Map the shared memory block handle into the client side process's 00313 * address space. 00314 */ 00315 ProcessHandleRecord = CONTAINING_RECORD(Console->ProcessHandleList.Blink, 00316 CONSOLE_PROCESS_HANDLE, 00317 ListLink); 00318 /* 00319 * For global properties pass in hWnd for the hClientSection 00320 */ 00321 if (!fCurrent) { 00322 hClientSection = Console->hWnd; 00323 goto PropCallback; 00324 } 00325 00326 /* 00327 * Create a shared memory block. 00328 */ 00329 li.QuadPart = sizeof(CONSOLE_STATE_INFO) + Console->OriginalTitleLength; 00330 Status = NtCreateSection(&hSection, 00331 SECTION_ALL_ACCESS, 00332 NULL, 00333 &li, 00334 PAGE_READWRITE, 00335 SEC_COMMIT, 00336 NULL); 00337 if (!NT_SUCCESS(Status)) { 00338 KdPrint(("CONSRV: error %x creating file mapping\n", Status)); 00339 return; 00340 } 00341 00342 /* 00343 * Get a pointer to the shared memory block. 00344 */ 00345 pStateInfo = NULL; 00346 ulViewSize = 0; 00347 Status = NtMapViewOfSection(hSection, 00348 NtCurrentProcess(), 00349 &pStateInfo, 00350 0, 00351 0, 00352 NULL, 00353 &ulViewSize, 00354 ViewUnmap, 00355 0, 00356 PAGE_READWRITE); 00357 if (!NT_SUCCESS(Status)) { 00358 KdPrint(("CONSRV: error %x mapping view of file\n", Status)); 00359 NtClose(hSection); 00360 return; 00361 } 00362 00363 /* 00364 * Fill in the shared memory block with the current values. 00365 */ 00366 ScreenInfo = Console->CurrentScreenBuffer; 00367 pStateInfo->Length = li.LowPart; 00368 pStateInfo->ScreenBufferSize = ScreenInfo->ScreenBufferSize; 00369 pStateInfo->WindowSize.X = CONSOLE_WINDOW_SIZE_X(ScreenInfo); 00370 pStateInfo->WindowSize.Y = CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 00371 pStateInfo->WindowPosX = Console->WindowRect.left; 00372 pStateInfo->WindowPosY = Console->WindowRect.top; 00373 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00374 pStateInfo->FontSize = SCR_FONTSIZE(ScreenInfo); 00375 pStateInfo->FontFamily = SCR_FAMILY(ScreenInfo); 00376 pStateInfo->FontWeight = SCR_FONTWEIGHT(ScreenInfo); 00377 wcscpy(pStateInfo->FaceName, SCR_FACENAME(ScreenInfo)); 00378 #if defined(FE_SB) 00379 // if TT font has external leading, the Size.Y <> SizeWant.Y 00380 // if we still pass actual Size.Y to console.cpl to query font, 00381 // it will be incorrect. Jun-26-1996 00382 00383 if (CONSOLE_IS_DBCS_ENABLED() && 00384 TM_IS_TT_FONT(SCR_FAMILY(ScreenInfo))) 00385 { 00386 if ((SCR_FONTNUMBER(ScreenInfo) >= 0 ) && 00387 (SCR_FONTNUMBER(ScreenInfo) < NumberOfFonts)) { 00388 00389 pStateInfo->FontSize = FontInfo[SCR_FONTNUMBER(ScreenInfo)].SizeWant; 00390 } 00391 } 00392 #endif 00393 pStateInfo->CursorSize = ScreenInfo->BufferInfo.TextInfo.CursorSize; 00394 } 00395 pStateInfo->FullScreen = Console->FullScreenFlags & CONSOLE_FULLSCREEN; 00396 pStateInfo->QuickEdit = Console->Flags & CONSOLE_QUICK_EDIT_MODE; 00397 pStateInfo->AutoPosition = Console->Flags & CONSOLE_AUTO_POSITION; 00398 pStateInfo->InsertMode = Console->InsertMode; 00399 pStateInfo->ScreenAttributes = ScreenInfo->Attributes; 00400 pStateInfo->PopupAttributes = ScreenInfo->PopupAttributes; 00401 pStateInfo->HistoryBufferSize = Console->CommandHistorySize; 00402 pStateInfo->NumberOfHistoryBuffers = Console->MaxCommandHistories; 00403 pStateInfo->HistoryNoDup = Console->Flags & CONSOLE_HISTORY_NODUP; 00404 RtlCopyMemory(pStateInfo->ColorTable, 00405 Console->ColorTable, 00406 sizeof(Console->ColorTable)); 00407 pStateInfo->hWnd = Console->hWnd; 00408 wcscpy(pStateInfo->ConsoleTitle, Console->OriginalTitle); 00409 #if defined(FE_SB) 00410 pStateInfo->CodePage = Console->OutputCP; 00411 #endif 00412 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00413 00414 Status = NtDuplicateObject(NtCurrentProcess(), 00415 hSection, 00416 ProcessHandleRecord->ProcessHandle, 00417 &hClientSection, 00418 0, 00419 0, 00420 DUPLICATE_SAME_ACCESS); 00421 if (!NT_SUCCESS(Status)) { 00422 KdPrint(("CONSRV: error %x mapping handle to client\n", Status)); 00423 NtClose(hSection); 00424 return; 00425 } 00426 00427 PropCallback: 00428 /* 00429 * Get a pointer to the client-side properties routine. 00430 */ 00431 MyPropRoutine = ProcessHandleRecord->PropRoutine; 00432 ASSERT(MyPropRoutine); 00433 00434 /* 00435 * Call back into the client process to spawn the properties dialog. 00436 */ 00437 UnlockConsole(Console); 00438 hThread = InternalCreateCallbackThread(ProcessHandleRecord->ProcessHandle, 00439 (ULONG_PTR)MyPropRoutine, 00440 (ULONG_PTR)hClientSection); 00441 if (!hThread) { 00442 KdPrint(("CONSRV: CreateRemoteThread failed %d\n", GetLastError())); 00443 } 00444 LockConsole(Console); 00445 00446 /* 00447 * Close any open handles and free allocated memory. 00448 */ 00449 if (hThread) 00450 NtClose(hThread); 00451 if (hSection) 00452 NtClose(hSection); 00453 00454 return; 00455 }

VOID PropertiesUpdate IN PCONSOLE_INFORMATION  Console,
IN HANDLE  hClientSection
 

Definition at line 459 of file ntcon/server/menu.c.

References ASSERT, _SCREEN_INFORMATION::BufferInfo, ChangeDispSettings(), CONSOLE_AUTO_POSITION, CONSOLE_HISTORY_NODUP, CONSOLE_IS_DBCS_ENABLED, CONSOLE_QUICK_EDIT_MODE, CONSOLE_VDM_REGISTERED, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, ConvertToFullScreen(), ConvertToWindowed(), DeleteCommandLine(), FALSE, FindCreateFont(), FullScreenInitialized, GetWindowLimits(), GetWindowPlacement, IsAvailableFarEastCodePage(), _WINDOW_LIMITS::MaximumWindowSize, min, NT_SUCCESS, NtClose(), NtDuplicateObject(), NtMapViewOfSection(), NTSTATUS(), NtUnmapViewOfSection(), NULL, _COOKED_READ_DATA::NumberOfVisibleChars, _SCREEN_INFORMATION::PopupAttributes, _CONSOLE_PROCESS_HANDLE::ProcessHandle, RedrawCommandLine(), ResizeCommandHistoryBuffers(), ResizeScreenBuffer(), SCR_FONTSIZE(), _SCREEN_INFORMATION::ScreenBufferSize, SetCursorInformation(), SetCursorMode(), SetScreenBufferFont(), SetScreenColors(), SetWindowPos, SHORT, Status, TRUE, and UINT.

Referenced by ConsoleWindowProc().

00471 { 00472 HANDLE hSection; 00473 SIZE_T ulViewSize; 00474 NTSTATUS Status; 00475 PCONSOLE_STATE_INFO pStateInfo; 00476 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00477 PSCREEN_INFORMATION ScreenInfo; 00478 ULONG FontIndex; 00479 WINDOWPLACEMENT wp; 00480 COORD NewSize; 00481 WINDOW_LIMITS WindowLimits; 00482 00483 /* 00484 * Map the shared memory block handle into our address space. 00485 */ 00486 ProcessHandleRecord = CONTAINING_RECORD(Console->ProcessHandleList.Blink, 00487 CONSOLE_PROCESS_HANDLE, 00488 ListLink); 00489 Status = NtDuplicateObject(ProcessHandleRecord->ProcessHandle, 00490 hClientSection, 00491 NtCurrentProcess(), 00492 &hSection, 00493 0, 00494 0, 00495 DUPLICATE_SAME_ACCESS); 00496 if (!NT_SUCCESS(Status)) { 00497 KdPrint(("CONSRV: error %x mapping client handle\n", Status)); 00498 return; 00499 } 00500 00501 /* 00502 * Get a pointer to the shared memory block. 00503 */ 00504 pStateInfo = NULL; 00505 ulViewSize = 0; 00506 Status = NtMapViewOfSection(hSection, 00507 NtCurrentProcess(), 00508 &pStateInfo, 00509 0, 00510 0, 00511 NULL, 00512 &ulViewSize, 00513 ViewUnmap, 00514 0, 00515 PAGE_READONLY); 00516 if (!NT_SUCCESS(Status)) { 00517 KdPrint(("CONSRV: error %x mapping view of file\n", Status)); 00518 NtClose(hSection); 00519 return; 00520 } 00521 00522 /* 00523 * Verify the size of the shared memory block. 00524 */ 00525 if (ulViewSize < sizeof(CONSOLE_STATE_INFO)) { 00526 KdPrint(("CONSRV: sizeof(hSection) < sizeof(CONSOLE_STATE_INFO)\n")); 00527 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00528 NtClose(hSection); 00529 return; 00530 } 00531 00532 ScreenInfo = Console->CurrentScreenBuffer; 00533 #if defined(FE_SB) 00534 if (Console->OutputCP != pStateInfo->CodePage) 00535 { 00536 UINT CodePage = Console->OutputCP; 00537 00538 Console->OutputCP = pStateInfo->CodePage; 00539 if (CONSOLE_IS_DBCS_ENABLED()) 00540 Console->fIsDBCSOutputCP = !!IsAvailableFarEastCodePage(Console->OutputCP); 00541 else 00542 Console->fIsDBCSOutputCP = FALSE; 00543 SetConsoleCPInfo(Console,TRUE); 00544 #if defined(FE_IME) 00545 SetImeOutputCodePage(Console, ScreenInfo, CodePage); 00546 #endif // FE_IME 00547 } 00548 if (Console->CP != pStateInfo->CodePage) 00549 { 00550 UINT CodePage = Console->CP; 00551 00552 Console->CP = pStateInfo->CodePage; 00553 if (CONSOLE_IS_DBCS_ENABLED()) 00554 Console->fIsDBCSCP = !!IsAvailableFarEastCodePage(Console->CP); 00555 else 00556 Console->fIsDBCSCP = FALSE; 00557 SetConsoleCPInfo(Console,FALSE); 00558 #if defined(FE_IME) 00559 SetImeCodePage(Console); 00560 #endif // FE_IME 00561 } 00562 #endif // FE_SB 00563 00564 /* 00565 * Update the console state from the supplied values. 00566 */ 00567 if (!(Console->Flags & CONSOLE_VDM_REGISTERED) && 00568 (pStateInfo->ScreenBufferSize.X != ScreenInfo->ScreenBufferSize.X || 00569 pStateInfo->ScreenBufferSize.Y != ScreenInfo->ScreenBufferSize.Y)) { 00570 00571 PCOOKED_READ_DATA CookedReadData = Console->lpCookedReadData; 00572 00573 if (CookedReadData && CookedReadData->NumberOfVisibleChars) { 00574 DeleteCommandLine(CookedReadData, FALSE); 00575 } 00576 ResizeScreenBuffer(ScreenInfo, 00577 pStateInfo->ScreenBufferSize, 00578 TRUE); 00579 if (CookedReadData && CookedReadData->NumberOfVisibleChars) { 00580 RedrawCommandLine(CookedReadData); 00581 } 00582 } 00583 #if !defined(FE_SB) 00584 FontIndex = FindCreateFont(pStateInfo->FontFamily, 00585 pStateInfo->FaceName, 00586 pStateInfo->FontSize, 00587 pStateInfo->FontWeight); 00588 #else 00589 FontIndex = FindCreateFont(pStateInfo->FontFamily, 00590 pStateInfo->FaceName, 00591 pStateInfo->FontSize, 00592 pStateInfo->FontWeight, 00593 pStateInfo->CodePage); 00594 #endif 00595 00596 #if defined(FE_SB) 00597 #if defined(i386) 00598 if (! (Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 00599 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00600 } 00601 else { 00602 ChangeDispSettings(Console, Console->hWnd, 0); 00603 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00604 ConvertToFullScreen(Console); 00605 ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00606 } 00607 #else // i386 00608 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00609 #endif 00610 #else // FE_SB 00611 SetScreenBufferFont(ScreenInfo, FontIndex); 00612 #endif // FE_SB 00613 SetCursorInformation(ScreenInfo, 00614 pStateInfo->CursorSize, 00615 ScreenInfo->BufferInfo.TextInfo.CursorVisible); 00616 00617 GetWindowLimits(ScreenInfo, &WindowLimits); 00618 NewSize.X = min(pStateInfo->WindowSize.X, WindowLimits.MaximumWindowSize.X); 00619 NewSize.Y = min(pStateInfo->WindowSize.Y, WindowLimits.MaximumWindowSize.Y); 00620 if (NewSize.X != CONSOLE_WINDOW_SIZE_X(ScreenInfo) || 00621 NewSize.Y != CONSOLE_WINDOW_SIZE_Y(ScreenInfo)) { 00622 wp.length = sizeof(wp); 00623 GetWindowPlacement(Console->hWnd, &wp); 00624 wp.rcNormalPosition.right += (NewSize.X - CONSOLE_WINDOW_SIZE_X(ScreenInfo)) * 00625 SCR_FONTSIZE(ScreenInfo).X; 00626 wp.rcNormalPosition.bottom += (NewSize.Y - CONSOLE_WINDOW_SIZE_Y(ScreenInfo)) * 00627 SCR_FONTSIZE(ScreenInfo).Y; 00628 SetWindowPlacement(Console->hWnd, &wp); 00629 } 00630 00631 #ifdef i386 00632 if (FullScreenInitialized) { 00633 if (pStateInfo->FullScreen == FALSE) { 00634 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00635 ConvertToWindowed(Console); 00636 #if defined(FE_SB) 00637 /* 00638 * Should not sets 0 always. 00639 * because exist CONSOLE_FULLSCREEN_HARDWARE bit by avobe 00640 * else { 00641 * ChangeDispSettings(Console, Console->hWnd, 0); 00642 * SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00643 * ConvertToFullScreen(Console); 00644 * ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00645 * } 00646 * block. 00647 * 00648 * This block enable as follows: 00649 * 1. console window is full screen 00650 * 2. open property by ALT+SPACE 00651 * 3. changes window mode by settings. 00652 */ 00653 Console->FullScreenFlags &= ~CONSOLE_FULLSCREEN; 00654 #else 00655 ASSERT(!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)); 00656 Console->FullScreenFlags = 0; 00657 #endif 00658 00659 ChangeDispSettings(Console, Console->hWnd, 0); 00660 } 00661 } else { 00662 if (Console->FullScreenFlags == 0) { 00663 ConvertToFullScreen(Console); 00664 Console->FullScreenFlags |= CONSOLE_FULLSCREEN; 00665 00666 ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00667 } 00668 } 00669 } 00670 #endif 00671 if (pStateInfo->QuickEdit) { 00672 Console->Flags |= CONSOLE_QUICK_EDIT_MODE; 00673 } else { 00674 Console->Flags &= ~CONSOLE_QUICK_EDIT_MODE; 00675 } 00676 if (pStateInfo->AutoPosition) { 00677 Console->Flags |= CONSOLE_AUTO_POSITION; 00678 } else { 00679 Console->Flags &= ~CONSOLE_AUTO_POSITION; 00680 SetWindowPos(Console->hWnd, NULL, 00681 pStateInfo->WindowPosX, 00682 pStateInfo->WindowPosY, 00683 0, 0, SWP_NOZORDER | SWP_NOSIZE); 00684 } 00685 if (Console->InsertMode != pStateInfo->InsertMode) { 00686 SetCursorMode(ScreenInfo, FALSE); 00687 Console->InsertMode = (pStateInfo->InsertMode != FALSE); 00688 #ifdef FE_SB 00689 if (Console->lpCookedReadData) { 00690 ((PCOOKED_READ_DATA)Console->lpCookedReadData)->InsertMode = Console->InsertMode; 00691 } 00692 #endif 00693 } 00694 00695 RtlCopyMemory(Console->ColorTable, 00696 pStateInfo->ColorTable, 00697 sizeof(Console->ColorTable)); 00698 SetScreenColors(ScreenInfo, 00699 pStateInfo->ScreenAttributes, 00700 pStateInfo->PopupAttributes, 00701 TRUE); 00702 00703 ResizeCommandHistoryBuffers(Console, pStateInfo->HistoryBufferSize); 00704 Console->MaxCommandHistories = (SHORT)pStateInfo->NumberOfHistoryBuffers; 00705 if (pStateInfo->HistoryNoDup) { 00706 Console->Flags |= CONSOLE_HISTORY_NODUP; 00707 } else { 00708 Console->Flags &= ~CONSOLE_HISTORY_NODUP; 00709 } 00710 00711 #if defined(FE_IME) 00712 SetUndetermineAttribute(Console) ; 00713 #endif 00714 00715 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00716 NtClose(hSection); 00717 00718 return; 00719 }

NTSTATUS QueueConsoleMessage PCONSOLE_INFORMATION  Console,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 4267 of file output.c.

References ASSERT, CM_CONSOLE_MSG, CONSOLE_MSG, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleLocked, _CONSOLE_INFORMATION::hWnd, _CONSOLE_MSG::ListLink, _CONSOLE_MSG::lParam, MAKE_TAG, _CONSOLE_MSG::Message, _CONSOLE_INFORMATION::MessageQueue, NULL, PCONSOLE_MSG, PostMessage(), TMP_TAG, and _CONSOLE_MSG::wParam.

Referenced by ConsoleWindowProc(), SrvSetConsoleCP(), and SrvSetConsoleDisplayMode().

04276 : 04277 04278 This inserts a message into the console's message queue and wakes up 04279 the console input thread to process it. 04280 04281 Arguments: 04282 04283 Console - Pointer to console information structure. 04284 04285 Message - Message to store in queue. 04286 04287 wParam - wParam to store in queue. 04288 04289 lParam - lParam to store in queue. 04290 04291 Return Value: 04292 04293 NTSTATUS - STATUS_SUCCESS if everything is OK. 04294 04295 --*/ 04296 04297 { 04298 PCONSOLE_MSG pConMsg; 04299 04300 ASSERT(ConsoleLocked(Console)); 04301 04302 pConMsg = (PCONSOLE_MSG)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ), sizeof(CONSOLE_MSG)); 04303 if (pConMsg == NULL) { 04304 return STATUS_NO_MEMORY; 04305 } 04306 04307 pConMsg->Message = Message; 04308 pConMsg->wParam = wParam; 04309 pConMsg->lParam = lParam; 04310 04311 InsertHeadList(&Console->MessageQueue, &pConMsg->ListLink); 04312 04313 if (!PostMessage(Console->hWnd, CM_CONSOLE_MSG, 0, 0)) { 04314 RemoveEntryList(&pConMsg->ListLink); 04315 ConsoleHeapFree(pConMsg); 04316 return STATUS_UNSUCCESSFUL; 04317 } 04318 04319 return STATUS_SUCCESS; 04320 }

NTSTATUS QueueThreadMessage DWORD  dwThreadId,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1860 of file ntcon/server/input.c.

References CM_CONSOLE_INPUT_THREAD_MSG, ConsoleHeapAlloc, ConsoleHeapFree, gInputThreadMsg, gInputThreadMsgLock, MAKE_TAG, NULL, PCONSOLE_THREAD_MSG, PostThreadMessage(), and TMP_TAG.

01865 { 01866 PCONSOLE_THREAD_MSG pConMsg; 01867 01868 // NOTE HIROYAMA: change this to RIP_VERBOSE 01869 RIPMSG4(RIP_VERBOSE, "QueueThreadMessage: TID=%08x msg:%04x (%08x, %08x)", 01870 dwThreadId, message, wParam, lParam); 01871 01872 pConMsg = ConsoleHeapAlloc(MAKE_TAG(TMP_TAG), sizeof *pConMsg); 01873 if (pConMsg == NULL) { 01874 RIPMSG0(RIP_WARNING, "QueueThreadMessage: failed to allocate pConMsg"); 01875 return STATUS_NO_MEMORY; 01876 } 01877 01878 pConMsg->dwThreadId = dwThreadId; 01879 pConMsg->Message = message; 01880 pConMsg->wParam = wParam; 01881 pConMsg->lParam = lParam; 01882 01883 RtlEnterCriticalSection(&gInputThreadMsgLock); 01884 InsertHeadList(&gInputThreadMsg, &pConMsg->ListLink); 01885 RtlLeaveCriticalSection(&gInputThreadMsgLock); 01886 01887 if (!PostThreadMessage(dwThreadId, CM_CONSOLE_INPUT_THREAD_MSG, 0, 0)) { 01888 RIPMSG1(RIP_WARNING, "QueueThreadMessage: failed to post thread msg(%04x)", message); 01889 RtlEnterCriticalSection(&gInputThreadMsgLock); 01890 RemoveEntryList(&pConMsg->ListLink); 01891 RtlLeaveCriticalSection(&gInputThreadMsgLock); 01892 ConsoleHeapFree(pConMsg); 01893 return STATUS_UNSUCCESSFUL; 01894 } 01895 01896 return STATUS_SUCCESS; 01897 }

NTSTATUS ReadBuffer IN PINPUT_INFORMATION  InputInformation,
OUT PVOID  Buffer,
IN ULONG  Length,
OUT PULONG  EventsRead,
IN BOOL  Peek,
IN BOOL  StreamRead,
OUT PBOOL  ResetWaitEvent,
IN BOOLEAN  Unicode
 

NTSTATUS ReadChars IN PINPUT_INFORMATION  InputInfo,
IN PCONSOLE_INFORMATION  Console,
IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN PSCREEN_INFORMATION  ScreenInfo,
IN OUT PWCHAR  lpBuffer,
IN OUT PDWORD  NumBytes,
IN DWORD  InitialNumBytes,
IN DWORD  CtrlWakeupMask,
IN PHANDLE_DATA  HandleData,
IN PCOMMAND_HISTORY  CommandHistory,
IN PCSR_API_MSG Message  OPTIONAL,
IN HANDLE  HandleIndex,
IN USHORT  ExeNameLength,
IN PWCHAR  ExeName,
IN BOOLEAN  Unicode
 

Definition at line 1778 of file server/stream.c.

References _COOKED_READ_DATA::BackupLimit, BOOL, _HANDLE_DATA::Buffer, BufferSize, _COOKED_READ_DATA::BufferSize, _RAW_READ_DATA::BufferSize, _COOKED_READ_DATA::BufPtr, _RAW_READ_DATA::BufPtr, _COOKED_READ_DATA::BytesRead, CloseOutputHandle(), _COOKED_READ_DATA::CommandHistory, _COOKED_READ_DATA::Console, _RAW_READ_DATA::Console, CONSOLE_OUTPUT_HANDLE, CONSOLE_STATUS_WAIT, ConsoleAddShare(), ConsoleHeapAlloc, ConsoleHeapFree, ConvertToOem(), COOKED_READ_DATA, CookedRead(), _COOKED_READ_DATA::CtrlWakeupMask, _COOKED_READ_DATA::CurrentPosition, DWORD, Echo(), _COOKED_READ_DATA::Echo, _COOKED_READ_DATA::ExeName, ExeNameLength, _COOKED_READ_DATA::ExeNameLength, FALSE, FindActiveScreenBufferHandle(), GetChar(), HANDLE_INPUT_PENDING, HANDLE_MULTI_LINE_INPUT, _COOKED_READ_DATA::HandleIndex, _RAW_READ_DATA::HandleIndex, _HANDLE_DATA::HandleType, HISTORY_TAG, _COOKED_READ_DATA::InputInfo, _RAW_READ_DATA::InputInfo, _COOKED_READ_DATA::InsertMode, INVALID_HANDLE_VALUE, _COOKED_READ_DATA::Line, LINE_INPUT_BUFFER_SIZE, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, _COOKED_READ_DATA::NumberOfVisibleChars, _COOKED_READ_DATA::OriginalCursorPosition, PBYTE, _COOKED_READ_DATA::ProcessData, _RAW_READ_DATA::ProcessData, _COOKED_READ_DATA::Processed, RAW_READ_DATA, RawReadWaitRoutine(), _COOKED_READ_DATA::ScreenInfo, SHORT, Status, _COOKED_READ_DATA::TempHandle, TMP_TAG, TranslateUnicodeToOem(), TRUE, Unicode, UNICODE_LINEFEED, _COOKED_READ_DATA::UserBuffer, and _COOKED_READ_DATA::UserBufferSize.

Referenced by SrvReadConsole().

01798 : 01799 01800 This routine reads in characters for stream input and does the 01801 required processing based on the input mode (line,char,echo). 01802 This routine returns UNICODE characters. 01803 01804 Arguments: 01805 01806 InputInfo - Pointer to input buffer information. 01807 01808 Console - Pointer to console buffer information. 01809 01810 ScreenInfo - Pointer to screen buffer information. 01811 01812 lpBuffer - Pointer to buffer to read into. 01813 01814 NumBytes - On input, size of buffer. On output, number of bytes 01815 read. 01816 01817 HandleData - Pointer to handle data structure. 01818 01819 Return Value: 01820 01821 --*/ 01822 01823 { 01824 DWORD BufferSize; 01825 NTSTATUS Status; 01826 HANDLE_DATA TempHandle; 01827 BOOLEAN Echo = FALSE; 01828 ULONG NumToWrite; 01829 #ifdef FE_SB 01830 PCONSOLE_READCONSOLE_MSG a = (PCONSOLE_READCONSOLE_MSG)&Message->u.ApiMessageData; 01831 BOOL fAddDbcsLead = FALSE; 01832 ULONG NumToBytes; 01833 #endif 01834 01835 BufferSize = *NumBytes; 01836 *NumBytes = 0; 01837 01838 if (HandleData->InputReadData->InputHandleFlags & HANDLE_INPUT_PENDING) { 01839 01840 // 01841 // if we have leftover input, copy as much fits into the user's 01842 // buffer and return. we may have multi line input, if a macro 01843 // has been defined that contains the $T character. 01844 // 01845 01846 if (HandleData->InputReadData->InputHandleFlags & HANDLE_MULTI_LINE_INPUT) { 01847 PWSTR Tmp; 01848 #ifdef FE_SB 01849 if (!Unicode && CONSOLE_IS_DBCS_CP(Console)) { 01850 01851 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 01852 fAddDbcsLead = TRUE; 01853 *lpBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 01854 BufferSize--; 01855 HandleData->InputReadData->BytesAvailable--; 01856 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 01857 } 01858 if (HandleData->InputReadData->BytesAvailable == 0 || 01859 BufferSize == 0) { 01860 HandleData->InputReadData->InputHandleFlags &= ~(HANDLE_INPUT_PENDING | HANDLE_MULTI_LINE_INPUT); 01861 ConsoleHeapFree(HandleData->InputReadData->BufPtr); 01862 *NumBytes = 1; 01863 return STATUS_SUCCESS; 01864 } 01865 else { 01866 for (NumToWrite=0,Tmp=HandleData->InputReadData->CurrentBufPtr,NumToBytes=0; 01867 NumToBytes < HandleData->InputReadData->BytesAvailable && NumToBytes < BufferSize/sizeof(WCHAR) && *Tmp!=UNICODE_LINEFEED; 01868 (IsConsoleFullWidth(Console->hDC, 01869 Console->CP,*Tmp) ? NumToBytes+=2 : NumToBytes++),Tmp++,NumToWrite+=sizeof(WCHAR)) ; 01870 } 01871 } 01872 #endif 01873 for (NumToWrite=0,Tmp=HandleData->InputReadData->CurrentBufPtr; 01874 NumToWrite < HandleData->InputReadData->BytesAvailable && *Tmp!=UNICODE_LINEFEED; 01875 Tmp++,NumToWrite+=sizeof(WCHAR)) ; 01876 NumToWrite += sizeof(WCHAR); 01877 if (NumToWrite > BufferSize) { 01878 NumToWrite = BufferSize; 01879 } 01880 } else { 01881 #ifdef FE_SB 01882 if (!Unicode && CONSOLE_IS_DBCS_CP(Console)) { 01883 PWSTR Tmp; 01884 01885 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 01886 fAddDbcsLead = TRUE; 01887 *lpBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 01888 BufferSize-=sizeof(WCHAR); 01889 HandleData->InputReadData->BytesAvailable-=sizeof(WCHAR); 01890 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 01891 } 01892 if (HandleData->InputReadData->BytesAvailable == 0) { 01893 HandleData->InputReadData->InputHandleFlags &= ~(HANDLE_INPUT_PENDING | HANDLE_MULTI_LINE_INPUT); 01894 ConsoleHeapFree(HandleData->InputReadData->BufPtr); 01895 *NumBytes = 1; 01896 return STATUS_SUCCESS; 01897 } 01898 else { 01899 for (NumToWrite=0,Tmp=HandleData->InputReadData->CurrentBufPtr,NumToBytes=0; 01900 NumToBytes < HandleData->InputReadData->BytesAvailable && NumToBytes < BufferSize/sizeof(WCHAR); 01901 (IsConsoleFullWidth(Console->hDC, 01902 Console->CP,*Tmp) ? NumToBytes+=2 : NumToBytes++),Tmp++,NumToWrite+=sizeof(WCHAR)) ; 01903 } 01904 } 01905 #endif 01906 NumToWrite = (BufferSize < HandleData->InputReadData->BytesAvailable) ? 01907 BufferSize : HandleData->InputReadData->BytesAvailable; 01908 } 01909 RtlCopyMemory(lpBuffer,HandleData->InputReadData->CurrentBufPtr,NumToWrite); 01910 HandleData->InputReadData->BytesAvailable-= NumToWrite; 01911 if (HandleData->InputReadData->BytesAvailable == 0) { 01912 HandleData->InputReadData->InputHandleFlags &= ~(HANDLE_INPUT_PENDING | HANDLE_MULTI_LINE_INPUT); 01913 ConsoleHeapFree(HandleData->InputReadData->BufPtr); 01914 } 01915 else { 01916 HandleData->InputReadData->CurrentBufPtr=(PWCHAR)((PBYTE)HandleData->InputReadData->CurrentBufPtr+NumToWrite); 01917 } 01918 if (!Unicode) { 01919 01920 // 01921 // if ansi, translate string. we allocated the capture buffer large 01922 // enough to handle the translated string. 01923 // 01924 01925 PCHAR TransBuffer; 01926 01927 #ifdef FE_SB 01928 if (CONSOLE_IS_DBCS_CP(Console)) 01929 TransBuffer = (PCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_DBCS_TAG ),NumToBytes); 01930 else 01931 #endif 01932 TransBuffer = (PCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),NumToWrite / sizeof(WCHAR)); 01933 if (TransBuffer == NULL) { 01934 return STATUS_NO_MEMORY; 01935 } 01936 01937 #ifdef FE_SB 01938 if (CONSOLE_IS_DBCS_CP(Console)) 01939 { 01940 NumToWrite = TranslateUnicodeToOem(Console, 01941 lpBuffer, 01942 NumToWrite / sizeof (WCHAR), 01943 TransBuffer, 01944 NumToBytes, 01945 &HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte); 01946 } 01947 else 01948 #endif 01949 NumToWrite = ConvertToOem(Console->CP, 01950 lpBuffer, 01951 NumToWrite / sizeof (WCHAR), 01952 TransBuffer, 01953 NumToWrite / sizeof (WCHAR) 01954 ); 01955 RtlCopyMemory(lpBuffer,TransBuffer,NumToWrite); 01956 #ifdef FE_SB 01957 if (fAddDbcsLead) 01958 NumToWrite++; 01959 #endif 01960 ConsoleHeapFree(TransBuffer); 01961 } 01962 *NumBytes = NumToWrite; 01963 return STATUS_SUCCESS; 01964 } 01965 01966 // 01967 // we need to create a temporary handle to the current screen buffer 01968 // if echo is on. 01969 // 01970 01971 if ((InputInfo->InputMode & (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT)) == 01972 (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT)) { 01973 HANDLE ActiveScreenHandle; 01974 01975 Echo = FALSE; 01976 ActiveScreenHandle = FindActiveScreenBufferHandle(ProcessData,Console); 01977 if (ActiveScreenHandle != INVALID_HANDLE_VALUE) { 01978 TempHandle.HandleType = CONSOLE_OUTPUT_HANDLE; 01979 TempHandle.Buffer.ScreenBuffer = Console->CurrentScreenBuffer; 01980 if (TempHandle.Buffer.ScreenBuffer != NULL) { 01981 Status = ConsoleAddShare(GENERIC_WRITE, 01982 FILE_SHARE_READ | FILE_SHARE_WRITE, 01983 &TempHandle.Buffer.ScreenBuffer->ShareAccess, 01984 &TempHandle 01985 ); 01986 if (NT_SUCCESS(Status)) { 01987 Echo = TRUE; 01988 TempHandle.Buffer.ScreenBuffer->RefCount++; 01989 } 01990 } 01991 } 01992 } 01993 01994 if (InputInfo->InputMode & ENABLE_LINE_INPUT) { 01995 01996 // 01997 // read in characters until the buffer is full or return is read. 01998 // since we may wait inside this loop, store all important variables 01999 // in the read data structure. if we do wait, a read data structure 02000 // will be allocated from the heap and its pointer will be stored 02001 // in the wait block. the CookedReadData will be copied into the 02002 // structure. the data is freed when the read is completed. 02003 // 02004 02005 COOKED_READ_DATA CookedReadData; 02006 ULONG i; 02007 PWCHAR TempBuffer; 02008 ULONG TempBufferSize; 02009 02010 // 02011 // to emulate OS/2 KbdStringIn, we read into our own big buffer 02012 // (256 bytes) until the user types enter. then return as many 02013 // chars as will fit in the user's buffer. 02014 // 02015 02016 TempBufferSize = (BufferSize < LINE_INPUT_BUFFER_SIZE) ? LINE_INPUT_BUFFER_SIZE : BufferSize; 02017 TempBuffer = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),TempBufferSize); 02018 if (TempBuffer==NULL) { 02019 if (Echo) { 02020 CloseOutputHandle(ProcessData, 02021 Console, 02022 &TempHandle, 02023 NULL, 02024 FALSE 02025 ); 02026 } 02027 return STATUS_NO_MEMORY; 02028 } 02029 02030 // 02031 // initialize the user's buffer to spaces. this is done so that 02032 // moving in the buffer via cursor doesn't do strange things. 02033 // 02034 02035 for (i=0;i<TempBufferSize/sizeof(WCHAR);i++) { 02036 TempBuffer[i] = (WCHAR)' '; 02037 } 02038 02039 CookedReadData.InputInfo = InputInfo; 02040 CookedReadData.ScreenInfo = ScreenInfo; 02041 CookedReadData.Console = Console; 02042 CookedReadData.TempHandle.HandleType = TempHandle.HandleType; 02043 CookedReadData.TempHandle.Buffer.ScreenBuffer = TempHandle.Buffer.ScreenBuffer; 02044 CookedReadData.BufferSize = TempBufferSize; 02045 CookedReadData.BytesRead = 0; 02046 CookedReadData.CurrentPosition = 0; 02047 CookedReadData.BufPtr = TempBuffer; 02048 CookedReadData.BackupLimit = TempBuffer; 02049 CookedReadData.UserBufferSize = BufferSize; 02050 CookedReadData.UserBuffer = lpBuffer; 02051 CookedReadData.OriginalCursorPosition.X = -1; 02052 CookedReadData.OriginalCursorPosition.Y = -1; 02053 CookedReadData.NumberOfVisibleChars = 0; 02054 CookedReadData.CtrlWakeupMask = CtrlWakeupMask; 02055 CookedReadData.CommandHistory = CommandHistory; 02056 CookedReadData.Echo = Echo; 02057 CookedReadData.InsertMode = Console->InsertMode; 02058 CookedReadData.Processed = (InputInfo->InputMode & ENABLE_PROCESSED_INPUT) != 0; 02059 CookedReadData.Line = (InputInfo->InputMode & ENABLE_LINE_INPUT) != 0; 02060 CookedReadData.ProcessData = ProcessData; 02061 CookedReadData.HandleIndex = HandleIndex; 02062 CookedReadData.ExeName = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( HISTORY_TAG ),ExeNameLength); 02063 if (InitialNumBytes != 0) { 02064 RtlCopyMemory(CookedReadData.BufPtr, CookedReadData.UserBuffer, InitialNumBytes); 02065 CookedReadData.BytesRead += InitialNumBytes; 02066 CookedReadData.NumberOfVisibleChars = (InitialNumBytes / sizeof(WCHAR)); 02067 CookedReadData.BufPtr += (InitialNumBytes / sizeof(WCHAR)); 02068 CookedReadData.CurrentPosition = (InitialNumBytes / sizeof(WCHAR)); 02069 CookedReadData.OriginalCursorPosition = ScreenInfo->BufferInfo.TextInfo.CursorPosition; 02070 CookedReadData.OriginalCursorPosition.X -= (SHORT)CookedReadData.CurrentPosition; 02071 02072 02073 while (CookedReadData.OriginalCursorPosition.X < 0) { 02074 CookedReadData.OriginalCursorPosition.X += ScreenInfo->ScreenBufferSize.X; 02075 CookedReadData.OriginalCursorPosition.Y -= 1; 02076 } 02077 } 02078 if (CookedReadData.ExeName) { 02079 RtlCopyMemory(CookedReadData.ExeName,ExeName,ExeNameLength); 02080 CookedReadData.ExeNameLength = ExeNameLength; 02081 } 02082 #ifdef FE_SB 02083 Console->lpCookedReadData = (PVOID)&CookedReadData; 02084 #endif 02085 02086 Status = CookedRead(&CookedReadData, 02087 Message, 02088 CSR_SERVER_QUERYCLIENTTHREAD(), 02089 FALSE 02090 ); 02091 #ifdef FE_SB 02092 if (Status != CONSOLE_STATUS_WAIT) { 02093 Console->lpCookedReadData = NULL; 02094 } 02095 #endif 02096 return Status; 02097 } 02098 02099 // 02100 // character (raw) mode 02101 // 02102 02103 else { 02104 02105 // 02106 // read at least one character in. after one character has been 02107 // read, get any more available characters and return. the first 02108 // call to GetChar may wait. if we do wait, a read data structure 02109 // will be allocated from the heap and its pointer will be stored 02110 // in the wait block. the RawReadData will be copied into the 02111 // structure. the data is freed when the read is completed. 02112 // 02113 02114 RAW_READ_DATA RawReadData; 02115 02116 RawReadData.InputInfo = InputInfo; 02117 RawReadData.Console = Console; 02118 RawReadData.BufferSize = BufferSize; 02119 RawReadData.BufPtr = lpBuffer; 02120 RawReadData.ProcessData = ProcessData; 02121 RawReadData.HandleIndex = HandleIndex; 02122 if (*NumBytes < BufferSize) { 02123 PWCHAR pwchT; 02124 02125 #ifdef FE_SB 02126 PWCHAR lpBufferTmp = lpBuffer; 02127 02128 NumToWrite = 0; 02129 if (!Unicode && CONSOLE_IS_DBCS_CP(Console)) { 02130 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 02131 fAddDbcsLead = TRUE; 02132 *lpBuffer++ = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar; 02133 BufferSize-=sizeof(WCHAR); 02134 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 02135 Status = STATUS_SUCCESS; 02136 if (BufferSize == 0) { 02137 *NumBytes = 1; 02138 return STATUS_SUCCESS; 02139 } 02140 } 02141 else{ 02142 Status = GetChar(InputInfo, 02143 lpBuffer, 02144 TRUE, 02145 Console, 02146 HandleData, 02147 Message, 02148 RawReadWaitRoutine, 02149 &RawReadData, 02150 sizeof(RawReadData), 02151 FALSE, 02152 NULL, 02153 NULL, 02154 NULL, 02155 NULL 02156 ); 02157 } 02158 } 02159 else 02160 #endif 02161 Status = GetChar(InputInfo, 02162 lpBuffer, 02163 TRUE, 02164 Console, 02165 HandleData, 02166 Message, 02167 RawReadWaitRoutine, 02168 &RawReadData, 02169 sizeof(RawReadData), 02170 FALSE, 02171 NULL, 02172 NULL, 02173 NULL, 02174 NULL 02175 ); 02176 02177 if (!NT_SUCCESS(Status)) { 02178 *NumBytes = 0; 02179 return Status; 02180 } 02181 #ifdef FE_SB 02182 if (! fAddDbcsLead) { 02183 IsConsoleFullWidth(Console->hDC, 02184 Console->CP,*lpBuffer) ? *NumBytes+=2 : ++*NumBytes; 02185 NumToWrite+=sizeof(WCHAR); 02186 lpBuffer++; 02187 } 02188 if (CONSOLE_IS_DBCS_CP(Console)) { 02189 while (NumToWrite < BufferSize) { 02190 Status = GetChar(InputInfo,lpBuffer,FALSE,NULL,NULL,NULL,NULL,NULL,0,FALSE,NULL,NULL,NULL,NULL); 02191 if (!NT_SUCCESS(Status)) { 02192 return STATUS_SUCCESS; 02193 } 02194 IsConsoleFullWidth(Console->hDC, 02195 Console->CP,*lpBuffer) ? *NumBytes+=2 : ++*NumBytes; 02196 lpBuffer++; 02197 NumToWrite+=sizeof(WCHAR); 02198 } 02199 } 02200 else{ 02201 #endif 02202 pwchT = lpBuffer + 1; 02203 *NumBytes += sizeof(WCHAR); 02204 while (*NumBytes < BufferSize) { 02205 Status = GetChar(InputInfo,pwchT,FALSE,NULL,NULL,NULL,NULL,NULL,0,FALSE,NULL,NULL,NULL,NULL); 02206 if (!NT_SUCCESS(Status)) { 02207 break; 02208 } 02209 pwchT++; 02210 *NumBytes += sizeof(WCHAR); 02211 } 02212 #ifdef FE_SB 02213 } 02214 #endif 02215 02216 // 02217 // if ansi, translate string. we allocated the capture buffer large 02218 // enough to handle the translated string. 02219 // 02220 02221 if (!Unicode) { 02222 02223 PCHAR TransBuffer; 02224 02225 TransBuffer = (PCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),*NumBytes / sizeof(WCHAR)); 02226 if (TransBuffer == NULL) { 02227 return STATUS_NO_MEMORY; 02228 } 02229 02230 #ifdef FE_SB 02231 lpBuffer = lpBufferTmp; 02232 if (CONSOLE_IS_DBCS_CP(Console)) 02233 { 02234 *NumBytes = TranslateUnicodeToOem(Console, 02235 lpBuffer, 02236 NumToWrite / sizeof (WCHAR), 02237 TransBuffer, 02238 *NumBytes, 02239 &HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte); 02240 } 02241 else 02242 #endif 02243 *NumBytes = ConvertToOem(Console->CP, 02244 lpBuffer, 02245 *NumBytes / sizeof (WCHAR), 02246 TransBuffer, 02247 *NumBytes / sizeof (WCHAR) 02248 ); 02249 RtlCopyMemory(lpBuffer,TransBuffer,*NumBytes); 02250 #ifdef FE_SB 02251 if (fAddDbcsLead) 02252 ++*NumBytes; 02253 #endif 02254 ConsoleHeapFree(TransBuffer); 02255 } 02256 } 02257 } 02258 return STATUS_SUCCESS; 02259 }

NTSTATUS ReadInputBuffer IN PINPUT_INFORMATION  InputInformation,
OUT PINPUT_RECORD  lpBuffer,
IN OUT PDWORD  nLength,
IN BOOL  Peek,
IN BOOL  WaitForData,
IN BOOL  StreamRead,
IN PCONSOLE_INFORMATION  Console,
IN PHANDLE_DATA HandleData  OPTIONAL,
IN PCSR_API_MSG Message  OPTIONAL,
IN CSR_WAIT_ROUTINE WaitRoutine  OPTIONAL,
IN PVOID WaitParameter  OPTIONAL,
IN ULONG WaitParameterLength  OPTIONAL,
IN BOOLEAN WaitBlockExists  OPTIONAL
 

Definition at line 959 of file ntcon/server/input.c.

References ASSERT, BOOL, CONSOLE_STATUS_WAIT, FALSE, LockConsole, LockReadCount, NT_SUCCESS, NtClearEvent(), NTSTATUS(), ReadBuffer(), Status, Unicode, UnlockReadCount, and WaitForMoreToRead().

Referenced by DirectReadWaitRoutine(), GetChar(), and SrvGetConsoleInput().

00981 : 00982 00983 This routine reads from the input buffer. 00984 00985 Arguments: 00986 00987 InputInformation - Pointer to input buffer information structure. 00988 00989 lpBuffer - Buffer to read into. 00990 00991 nLength - On input, number of events to read. On output, number of 00992 events read. 00993 00994 Peek - If TRUE, copy events to lpBuffer but don't remove them from 00995 the input buffer. 00996 00997 WaitForData - if TRUE, wait until an event is input. if FALSE, return 00998 immediately 00999 01000 StreamRead - if TRUE, events with repeat counts > 1 are returned 01001 as multiple events. also, EventsRead == 1. 01002 01003 Console - Pointer to console buffer information. 01004 01005 HandleData - Pointer to handle data structure. This parameter is 01006 optional if WaitForData is false. 01007 01008 Message - if called from dll (not InputThread), points to api 01009 message. this parameter is used for wait block processing. 01010 01011 WaitRoutine - Routine to call when wait is woken up. 01012 01013 WaitParameter - Parameter to pass to wait routine. 01014 01015 WaitParameterLength - Length of wait parameter. 01016 01017 WaitBlockExists - TRUE if wait block has already been created. 01018 01019 Return Value: 01020 01021 Note: 01022 01023 The console lock must be held when calling this routine. 01024 01025 --*/ 01026 01027 { 01028 ULONG EventsRead; 01029 NTSTATUS Status; 01030 BOOL ResetWaitEvent; 01031 01032 if (InputInformation->In == InputInformation->Out) { 01033 if (!WaitForData) { 01034 *nLength = 0; 01035 return STATUS_SUCCESS; 01036 } 01037 LockReadCount(HandleData); 01038 HandleData->InputReadData->ReadCount += 1; 01039 UnlockReadCount(HandleData); 01040 Status = WaitForMoreToRead(InputInformation, 01041 Message, 01042 WaitRoutine, 01043 WaitParameter, 01044 WaitParameterLength, 01045 WaitBlockExists 01046 ); 01047 01048 if (!NT_SUCCESS(Status)) { 01049 if (Status != CONSOLE_STATUS_WAIT) { 01050 /* 01051 * WaitForMoreToRead failed, restore ReadCount and bale out 01052 */ 01053 LockReadCount(HandleData); 01054 HandleData->InputReadData->ReadCount -= 1; 01055 UnlockReadCount(HandleData); 01056 } 01057 *nLength = 0; 01058 return Status; 01059 } 01060 01061 // 01062 // we will only get to this point if we were called by GetInput. 01063 // 01064 ASSERT(FALSE); // I say we never get here ! IANJA 01065 01066 LockConsole(Console); 01067 } 01068 01069 // 01070 // read from buffer 01071 // 01072 01073 Status = ReadBuffer(InputInformation, 01074 lpBuffer, 01075 *nLength, 01076 &EventsRead, 01077 Peek, 01078 StreamRead, 01079 &ResetWaitEvent 01080 #if defined(FE_SB) 01081 , 01082 Unicode 01083 #endif 01084 ); 01085 if (ResetWaitEvent) { 01086 NtClearEvent(InputInformation->InputWaitEvent); 01087 } 01088 01089 *nLength = EventsRead; 01090 return Status; 01091 }

NTSTATUS ReadOutputString IN PSCREEN_INFORMATION  ScreenInfo,
OUT PVOID  Buffer,
IN COORD  ReadCoord,
IN ULONG  StringType,
IN OUT PULONG  NumRecords
 

Definition at line 1795 of file output.c.

References _ATTR_PAIR::Attr, _ROW::AttrRow, _ATTR_ROW::Attrs, Buffer, BYTE, CHAR, _ROW::CharRow, _CHAR_ROW::Chars, CONSOLE_ASCII, CONSOLE_ATTRIBUTE, CONSOLE_FALSE_UNICODE, CONSOLE_OEMFONT_DISPLAY, CONSOLE_REAL_UNICODE, ConsoleHeapAlloc, ConsoleHeapFree, ConvertOutputToOem(), DBGOUTPUT, FalseUnicodeToRealUnicode(), FindAttrIndex(), _ATTR_PAIR::Length, MAKE_TAG, NULL, PBYTE, SHORT, TMP_TAG, UINT, UNICODE_SPACE, USACP, WcharToChar(), and WINDOWSCP.

Referenced by SrvReadConsoleOutputString().

01805 : 01806 01807 This routine reads a string of characters or attributes from the 01808 screen buffer. 01809 01810 Arguments: 01811 01812 ScreenInfo - Pointer to screen buffer information. 01813 01814 Buffer - Buffer to read into. 01815 01816 ReadCoord - Screen buffer coordinate to begin reading from. 01817 01818 StringType 01819 01820 CONSOLE_ASCII - read a string of ASCII characters. 01821 CONSOLE_REAL_UNICODE - read a string of Real Unicode characters. 01822 CONSOLE_FALSE_UNICODE - read a string of False Unicode characters. 01823 CONSOLE_ATTRIBUTE - read a string of attributes. 01824 01825 NumRecords - On input, the size of the buffer in elements. On output, 01826 the number of elements read. 01827 01828 Return Value: 01829 01830 01831 --*/ 01832 01833 { 01834 ULONG NumRead; 01835 SHORT X,Y; 01836 SHORT RowIndex; 01837 SHORT CountOfAttr; 01838 PATTR_PAIR Attr; 01839 PROW Row; 01840 PWCHAR Char; 01841 SHORT j,k; 01842 PWCHAR TransBuffer = NULL; 01843 PWCHAR BufPtr; 01844 #if defined(FE_SB) 01845 PBYTE AttrP; 01846 PBYTE TransBufferA,BufPtrA; 01847 PCONSOLE_INFORMATION Console = ScreenInfo->Console; 01848 #endif 01849 01850 DBGOUTPUT(("ReadOutputString\n")); 01851 if (*NumRecords == 0) 01852 return STATUS_SUCCESS; 01853 NumRead = 0; 01854 X=ReadCoord.X; 01855 Y=ReadCoord.Y; 01856 if (X>=ScreenInfo->ScreenBufferSize.X || 01857 X<0 || 01858 Y>=ScreenInfo->ScreenBufferSize.Y || 01859 Y<0) { 01860 *NumRecords = 0; 01861 return STATUS_SUCCESS; 01862 } 01863 01864 RowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+ReadCoord.Y) % ScreenInfo->ScreenBufferSize.Y; 01865 01866 if (StringType == CONSOLE_ASCII) { 01867 TransBuffer = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),*NumRecords * sizeof(WCHAR)); 01868 if (TransBuffer == NULL) { 01869 return STATUS_NO_MEMORY; 01870 } 01871 BufPtr = TransBuffer; 01872 } else { 01873 BufPtr = Buffer; 01874 } 01875 01876 #if defined(FE_SB) 01877 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 01878 { 01879 TransBufferA = (PBYTE)ConsoleHeapAlloc(MAKE_TAG( TMP_DBCS_TAG ),*NumRecords * sizeof(BYTE)); 01880 if (TransBufferA == NULL) { 01881 if (TransBuffer != NULL) 01882 ConsoleHeapFree(TransBuffer); 01883 return STATUS_NO_MEMORY; 01884 } 01885 BufPtrA = TransBufferA; 01886 } 01887 #endif 01888 if ((StringType == CONSOLE_ASCII) || 01889 (StringType == CONSOLE_REAL_UNICODE) || 01890 (StringType == CONSOLE_FALSE_UNICODE)) { 01891 while (NumRead < *NumRecords) { 01892 01893 // 01894 // copy the chars from its array 01895 // 01896 01897 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 01898 Char = &Row->CharRow.Chars[X]; 01899 #if defined(FE_SB) 01900 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 01901 AttrP = &Row->CharRow.KAttrs[X]; 01902 #endif 01903 if ((ULONG)(ScreenInfo->ScreenBufferSize.X - X) > (*NumRecords - NumRead)) { 01904 RtlCopyMemory(BufPtr,Char,(*NumRecords - NumRead) * sizeof(WCHAR)); 01905 #if defined(FE_SB) 01906 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 01907 RtlCopyMemory(BufPtrA,AttrP,(*NumRecords - NumRead) * sizeof(CHAR)); 01908 #endif 01909 NumRead += *NumRecords - NumRead; 01910 break; 01911 } 01912 RtlCopyMemory(BufPtr,Char,(ScreenInfo->ScreenBufferSize.X - X) * sizeof(WCHAR)); 01913 BufPtr = (PVOID)((PBYTE)BufPtr + ((ScreenInfo->ScreenBufferSize.X - X) * sizeof(WCHAR))); 01914 #if defined(FE_SB) 01915 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 01916 RtlCopyMemory(BufPtrA,AttrP,(ScreenInfo->ScreenBufferSize.X - X) * sizeof(CHAR)); 01917 BufPtrA = (PVOID)((PBYTE)BufPtrA + ((ScreenInfo->ScreenBufferSize.X - X) * sizeof(CHAR))); 01918 } 01919 #endif 01920 NumRead += ScreenInfo->ScreenBufferSize.X - X; 01921 if (++RowIndex == ScreenInfo->ScreenBufferSize.Y) { 01922 RowIndex = 0; 01923 } 01924 X = 0; 01925 Y++; 01926 if (Y>=ScreenInfo->ScreenBufferSize.Y) { 01927 break; 01928 } 01929 } 01930 #if defined(FE_SB) 01931 if (CONSOLE_IS_DBCS_OUTPUTCP(Console) && (NumRead)) { 01932 if (StringType == CONSOLE_ASCII) { 01933 Char = BufPtr = TransBuffer; 01934 } else { 01935 Char = BufPtr = Buffer; 01936 } 01937 AttrP = BufPtrA = TransBufferA; 01938 01939 if (*BufPtrA & ATTR_TRAILING_BYTE) 01940 { 01941 j = k = (SHORT)(NumRead - 1); 01942 BufPtr++; 01943 *Char++ = UNICODE_SPACE; 01944 BufPtrA++; 01945 NumRead = 1; 01946 } 01947 else { 01948 j = k = (SHORT)NumRead; 01949 NumRead = 0; 01950 } 01951 while (j--) { 01952 if (!(*BufPtrA & ATTR_TRAILING_BYTE)) { 01953 *Char++ = *BufPtr; 01954 NumRead++; 01955 } 01956 BufPtr++; 01957 BufPtrA++; 01958 } 01959 if (k && *(BufPtrA-1) & ATTR_LEADING_BYTE) 01960 { 01961 *(Char-1) = UNICODE_SPACE; 01962 } 01963 } 01964 #endif 01965 } else if (StringType == CONSOLE_ATTRIBUTE) { 01966 PWORD TargetPtr=BufPtr; 01967 while (NumRead < *NumRecords) { 01968 01969 // 01970 // copy the attrs from its array 01971 // 01972 01973 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 01974 #if defined(FE_SB) 01975 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 01976 AttrP = &Row->CharRow.KAttrs[X]; 01977 #endif 01978 FindAttrIndex(Row->AttrRow.Attrs, 01979 X, 01980 &Attr, 01981 &CountOfAttr 01982 ); 01983 k=0; 01984 for (j=X;j<ScreenInfo->ScreenBufferSize.X;TargetPtr++) { 01985 #if defined(FE_SB) 01986 if (!CONSOLE_IS_DBCS_OUTPUTCP(Console) ) 01987 *TargetPtr = Attr->Attr; 01988 else if ((j == X) && (*AttrP & ATTR_TRAILING_BYTE)) 01989 *TargetPtr = Attr->Attr; 01990 else if (*AttrP & ATTR_LEADING_BYTE){ 01991 if ((NumRead == *NumRecords-1)||(j == ScreenInfo->ScreenBufferSize.X-1)) 01992 *TargetPtr = Attr->Attr; 01993 else 01994 *TargetPtr = Attr->Attr | (WCHAR)(*AttrP & ATTR_DBCSSBCS_BYTE) << 8; 01995 } 01996 else 01997 *TargetPtr = Attr->Attr | (WCHAR)(*AttrP & ATTR_DBCSSBCS_BYTE) << 8; 01998 #else 01999 *TargetPtr = Attr->Attr; 02000 #endif 02001 NumRead++; 02002 j+=1; 02003 if (++k==CountOfAttr && j<ScreenInfo->ScreenBufferSize.X) { 02004 Attr++; 02005 k=0; 02006 CountOfAttr = Attr->Length; 02007 } 02008 if (NumRead == *NumRecords) { 02009 #if defined(FE_SB) 02010 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02011 ConsoleHeapFree(TransBufferA); 02012 #endif 02013 return STATUS_SUCCESS; 02014 } 02015 #if defined(FE_SB) 02016 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02017 AttrP++; 02018 #endif 02019 } 02020 if (++RowIndex == ScreenInfo->ScreenBufferSize.Y) { 02021 RowIndex = 0; 02022 } 02023 X = 0; 02024 Y++; 02025 if (Y>=ScreenInfo->ScreenBufferSize.Y) { 02026 break; 02027 } 02028 } 02029 } else { 02030 *NumRecords = 0; 02031 #if defined(FE_SB) 02032 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02033 ConsoleHeapFree(TransBufferA); 02034 #endif 02035 return STATUS_INVALID_PARAMETER; 02036 } 02037 02038 if (StringType == CONSOLE_ASCII) { 02039 UINT Codepage; 02040 #if defined(FE_SB) 02041 if ((ScreenInfo->Flags & CONSOLE_OEMFONT_DISPLAY) && 02042 !(ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 02043 if (ScreenInfo->Console->OutputCP != WINDOWSCP) 02044 Codepage = USACP; 02045 else 02046 Codepage = WINDOWSCP; 02047 } else { 02048 Codepage = ScreenInfo->Console->OutputCP; 02049 } 02050 #else 02051 if ((ScreenInfo->Flags & CONSOLE_OEMFONT_DISPLAY) && 02052 !(ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 02053 Codepage = WINDOWSCP; 02054 } else { 02055 Codepage = ScreenInfo->Console->OutputCP; 02056 } 02057 #endif 02058 #if defined(FE_SB) 02059 if ((NumRead == 1) && !CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02060 #else 02061 if (NumRead == 1) 02062 #endif 02063 { 02064 *((PBYTE)Buffer) = WcharToChar(Codepage, *TransBuffer); 02065 } else { 02066 NumRead = ConvertOutputToOem(Codepage, TransBuffer, NumRead, Buffer, *NumRecords); 02067 } 02068 ConsoleHeapFree(TransBuffer); 02069 } else if (StringType == CONSOLE_REAL_UNICODE && 02070 (ScreenInfo->Flags & CONSOLE_OEMFONT_DISPLAY) && 02071 !(ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 02072 /* 02073 * Buffer contains false Unicode (UnicodeOem) only in Windowed 02074 * RasterFont mode, so in this case, convert it to real Unicode. 02075 */ 02076 FalseUnicodeToRealUnicode(Buffer, 02077 NumRead, 02078 ScreenInfo->Console->OutputCP 02079 ); 02080 } 02081 02082 #if defined(FE_SB) 02083 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) 02084 ConsoleHeapFree(TransBufferA); 02085 #endif 02086 *NumRecords = NumRead; 02087 return STATUS_SUCCESS; 02088 }

VOID ReadRectFromScreenBuffer IN PSCREEN_INFORMATION  ScreenInfo,
IN COORD  SourcePoint,
IN PCHAR_INFO  Target,
IN COORD  TargetSize,
IN PSMALL_RECT  TargetRect
 

Definition at line 1415 of file output.c.

References ASSERT, _ATTR_PAIR::Attr, _ROW::AttrRow, _ATTR_ROW::Attrs, BYTE, _ROW::CharRow, _CHAR_ROW::Chars, DBGOUTPUT, FALSE, FindAttrIndex(), _ATTR_PAIR::Length, PBYTE, SCREEN_BUFFER_POINTER, SHORT, TRUE, and UNICODE_SPACE.

Referenced by CopyRectangle(), FE_WriteRegionToScreenHW(), ReadScreenBuffer(), ScrollRegion(), and StoreSelection().

01425 : 01426 01427 This routine copies a rectangular region from the screen buffer. 01428 no clipping is done. 01429 01430 Arguments: 01431 01432 ScreenInfo - pointer to screen info 01433 01434 SourcePoint - upper left coordinates of source rectangle 01435 01436 Target - pointer to target buffer 01437 01438 TargetSize - dimensions of target buffer 01439 01440 TargetRect - rectangle in source buffer to copy 01441 01442 Return Value: 01443 01444 none. 01445 01446 --*/ 01447 01448 { 01449 01450 PCHAR_INFO TargetPtr; 01451 SHORT i,j,k; 01452 SHORT XSize,YSize; 01453 BOOLEAN WholeTarget; 01454 SHORT RowIndex; 01455 PROW Row; 01456 PWCHAR Char; 01457 PATTR_PAIR Attr; 01458 SHORT CountOfAttr; 01459 01460 DBGOUTPUT(("ReadRectFromScreenBuffer\n")); 01461 01462 XSize = (SHORT)(TargetRect->Right - TargetRect->Left + 1); 01463 YSize = (SHORT)(TargetRect->Bottom - TargetRect->Top + 1); 01464 01465 TargetPtr = Target; 01466 WholeTarget = FALSE; 01467 if (XSize == TargetSize.X) { 01468 ASSERT (TargetRect->Left == 0); 01469 if (TargetRect->Top != 0) { 01470 TargetPtr = (PCHAR_INFO) 01471 ((PBYTE)Target + SCREEN_BUFFER_POINTER(TargetRect->Left, 01472 TargetRect->Top, 01473 TargetSize.X, 01474 sizeof(CHAR_INFO))); 01475 } 01476 WholeTarget = TRUE; 01477 } 01478 RowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+SourcePoint.Y) % ScreenInfo->ScreenBufferSize.Y; 01479 for (i=0;i<YSize;i++) { 01480 if (!WholeTarget) { 01481 TargetPtr = (PCHAR_INFO) 01482 ((PBYTE)Target + SCREEN_BUFFER_POINTER(TargetRect->Left, 01483 TargetRect->Top+i, 01484 TargetSize.X, 01485 sizeof(CHAR_INFO))); 01486 } 01487 01488 // 01489 // copy the chars and attrs from their respective arrays 01490 // 01491 01492 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 01493 Char = &Row->CharRow.Chars[SourcePoint.X]; 01494 FindAttrIndex(Row->AttrRow.Attrs, 01495 SourcePoint.X, 01496 &Attr, 01497 &CountOfAttr 01498 ); 01499 k=0; 01500 #if defined(FE_SB) 01501 if (CONSOLE_IS_DBCS_OUTPUTCP(ScreenInfo->Console)) { 01502 PBYTE AttrP = &Row->CharRow.KAttrs[SourcePoint.X]; 01503 for (j=0;j<XSize;TargetPtr++) { 01504 BYTE AttrR; 01505 AttrR = *AttrP++; 01506 if (j==0 && AttrR & ATTR_TRAILING_BYTE) 01507 { 01508 TargetPtr->Char.UnicodeChar = UNICODE_SPACE; 01509 AttrR = 0; 01510 } 01511 else if (j+1 >= XSize && AttrR & ATTR_LEADING_BYTE) 01512 { 01513 TargetPtr->Char.UnicodeChar = UNICODE_SPACE; 01514 AttrR = 0; 01515 } 01516 else 01517 TargetPtr->Char.UnicodeChar = *Char; 01518 Char++; 01519 TargetPtr->Attributes = Attr->Attr | (WCHAR)(AttrR & ATTR_DBCSSBCS_BYTE) << 8; 01520 j+=1; 01521 if (++k==CountOfAttr && j<XSize) { 01522 Attr++; 01523 k=0; 01524 CountOfAttr = Attr->Length; 01525 } 01526 } 01527 } 01528 else{ 01529 #endif 01530 for (j=0;j<XSize;TargetPtr++) { 01531 TargetPtr->Char.UnicodeChar = *Char++; 01532 TargetPtr->Attributes = Attr->Attr; 01533 j+=1; 01534 if (++k==CountOfAttr && j<XSize) { 01535 Attr++; 01536 k=0; 01537 CountOfAttr = Attr->Length; 01538 } 01539 } 01540 #if defined(FE_SB) 01541 } 01542 #endif 01543 01544 if (++RowIndex == ScreenInfo->ScreenBufferSize.Y) { 01545 RowIndex = 0; 01546 } 01547 } 01548 }

NTSTATUS ReadScreenBuffer IN PSCREEN_INFORMATION  ScreenInformation,
OUT PCHAR_INFO  Buffer,
IN OUT PSMALL_RECT  ReadRegion
 

Definition at line 1623 of file output.c.

References Buffer, DBGOUTPUT, ReadRectFromScreenBuffer(), and SHORT.

Referenced by BeginPopup(), and SrvReadConsoleOutput().

01631 : 01632 01633 This routine reads a rectangular region from the screen buffer. 01634 The region is first clipped. 01635 01636 Arguments: 01637 01638 ScreenInformation - Screen buffer to read from. 01639 01640 Buffer - Buffer to read into. 01641 01642 ReadRegion - Region to read. 01643 01644 Return Value: 01645 01646 01647 --*/ 01648 01649 { 01650 COORD TargetSize; 01651 COORD TargetPoint,SourcePoint; 01652 SMALL_RECT Target; 01653 01654 DBGOUTPUT(("ReadScreenBuffer\n")); 01655 // 01656 // calculate dimensions of caller's buffer. have to do this calculation 01657 // before clipping. 01658 // 01659 01660 TargetSize.X = (SHORT)(ReadRegion->Right - ReadRegion->Left + 1); 01661 TargetSize.Y = (SHORT)(ReadRegion->Bottom - ReadRegion->Top + 1); 01662 01663 if (TargetSize.X <= 0 || TargetSize.Y <= 0) { 01664 return STATUS_SUCCESS; 01665 } 01666 01667 // do clipping. 01668 01669 if (ReadRegion->Right > (SHORT)(ScreenInformation->ScreenBufferSize.X-1)) { 01670 ReadRegion->Right = (SHORT)(ScreenInformation->ScreenBufferSize.X-1); 01671 } 01672 if (ReadRegion->Bottom > (SHORT)(ScreenInformation->ScreenBufferSize.Y-1)) { 01673 ReadRegion->Bottom = (SHORT)(ScreenInformation->ScreenBufferSize.Y-1); 01674 } 01675 if (ReadRegion->Left < 0) { 01676 TargetPoint.X = -ReadRegion->Left; 01677 ReadRegion->Left = 0; 01678 } 01679 else { 01680 TargetPoint.X = 0; 01681 } 01682 if (ReadRegion->Top < 0) { 01683 TargetPoint.Y = -ReadRegion->Top; 01684 ReadRegion->Top = 0; 01685 } 01686 else { 01687 TargetPoint.Y = 0; 01688 } 01689 01690 SourcePoint.X = ReadRegion->Left; 01691 SourcePoint.Y = ReadRegion->Top; 01692 Target.Left = TargetPoint.X; 01693 Target.Top = TargetPoint.Y; 01694 Target.Right = TargetPoint.X + (ReadRegion->Right - ReadRegion->Left); 01695 Target.Bottom = TargetPoint.Y + (ReadRegion->Bottom - ReadRegion->Top); 01696 ReadRectFromScreenBuffer(ScreenInformation, 01697 SourcePoint, 01698 Buffer, 01699 TargetSize, 01700 &Target 01701 ); 01702 return STATUS_SUCCESS; 01703 }

NTSTATUS RealUnicodeToFalseUnicode IN OUT LPWSTR  Source,
IN int  SourceLength,
IN UINT  Codepage
 

Definition at line 1573 of file w32/ntcon/server/misc.c.

References BOOL, CHAR, CONSOLE_IS_DBCS_ENABLED, ConsoleHeapAlloc, ConsoleHeapFree, DBGCHARS, FALSE, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, RtlMultiByteToUnicodeN(), RtlUnicodeToOemN(), STACK_BUFFER_SIZE, Status, TMP_TAG, TRUE, USACP, and WINDOWSCP.

Referenced by ConvertToWindowed(), FE_TranslateOutputToAnsiUnicodeInternal(), SB_TranslateOutputToAnsiUnicode(), SetScreenBufferFont(), SrvScrollConsoleScreenBuffer(), WWSB_DoSrvWriteConsole(), WWSB_FillOutput(), WWSB_WriteChars(), and WWSB_WriteOutputString().

01588 { 01589 NTSTATUS Status; 01590 LPSTR Temp; 01591 ULONG TempLength; 01592 ULONG Length; 01593 CHAR StackBuffer[STACK_BUFFER_SIZE]; 01594 BOOL NormalChars; 01595 int i; 01596 01597 DBGCHARS(("RealUnicodeToFalseUnicode U->%d:ACP->U %.*ls\n", Codepage, 01598 SourceLength > 10 ? 10 : SourceLength, Source)); 01599 #if defined(FE_SB) 01600 if (OEMCP == WINDOWSCP && Codepage == WINDOWSCP) 01601 return STATUS_SUCCESS; 01602 if (SourceLength == 0 ) 01603 return STATUS_SUCCESS; 01604 #endif 01605 NormalChars = TRUE; 01606 for (i=0;i<SourceLength;i++) { 01607 if (Source[i] > 0x7f) { 01608 NormalChars = FALSE; 01609 break; 01610 } 01611 } 01612 if (NormalChars) { 01613 return STATUS_SUCCESS; 01614 } 01615 TempLength = SourceLength; 01616 if (TempLength > STACK_BUFFER_SIZE) { 01617 Temp = (LPSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),TempLength); 01618 if (Temp == NULL) { 01619 return STATUS_NO_MEMORY; 01620 } 01621 } else { 01622 Temp = StackBuffer; 01623 } 01624 if (Codepage == OEMCP) { 01625 Status = RtlUnicodeToOemN(Temp, 01626 TempLength, 01627 &Length, 01628 Source, 01629 SourceLength * sizeof(WCHAR) 01630 ); 01631 } else { 01632 Status = WideCharToMultiByte(Codepage, 01633 0, 01634 Source, 01635 SourceLength, 01636 Temp, 01637 TempLength, 01638 NULL, 01639 NULL); 01640 } 01641 if (!NT_SUCCESS(Status)) { 01642 if (TempLength > STACK_BUFFER_SIZE) { 01643 ConsoleHeapFree(Temp); 01644 } 01645 return Status; 01646 } 01647 01648 if (CONSOLE_IS_DBCS_ENABLED()) { 01649 MultiByteToWideChar(USACP, 01650 0, 01651 Temp, 01652 TempLength, 01653 Source, 01654 SourceLength 01655 ); 01656 } else { 01657 Status = RtlMultiByteToUnicodeN(Source, 01658 SourceLength * sizeof(WCHAR), 01659 &Length, 01660 Temp, 01661 TempLength 01662 ); 01663 } 01664 01665 if (TempLength > STACK_BUFFER_SIZE) { 01666 ConsoleHeapFree(Temp); 01667 } 01668 if (!NT_SUCCESS(Status)) { 01669 return Status; 01670 } else { 01671 return STATUS_SUCCESS; 01672 } 01673 }

NTSTATUS ReinitializeInputBuffer OUT PINPUT_INFORMATION  InputBufferInformation  ) 
 

Definition at line 184 of file ntcon/server/input.c.

References NtClearEvent().

Referenced by CloseInputHandle().

00190 : 00191 00192 This routine resets the input buffer information fields to their 00193 initial values. 00194 00195 Arguments: 00196 00197 InputBufferInformation - Pointer to input buffer information structure. 00198 00199 Return Value: 00200 00201 Note: 00202 00203 The console lock must be held when calling this routine. 00204 00205 --*/ 00206 00207 { 00208 NtClearEvent(InputBufferInformation->InputWaitEvent); 00209 InputBufferInformation->ShareAccess.OpenCount = 0; 00210 InputBufferInformation->ShareAccess.Readers = 0; 00211 InputBufferInformation->ShareAccess.Writers = 0; 00212 InputBufferInformation->ShareAccess.SharedRead = 0; 00213 InputBufferInformation->ShareAccess.SharedWrite = 0; 00214 InputBufferInformation->InputMode = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT; 00215 InputBufferInformation->In = (ULONG_PTR) InputBufferInformation->InputBuffer; 00216 InputBufferInformation->Out = (ULONG_PTR) InputBufferInformation->InputBuffer; 00217 return STATUS_SUCCESS; 00218 }

NTSTATUS RemoveConsole IN PCONSOLE_PER_PROCESS_DATA  ProcessData,
IN HANDLE  ProcessHandle,
IN HANDLE  ProcessId
 

Definition at line 1355 of file srvinit.c.

References ASSERT, CloseInputHandle(), CloseOutputHandle(), CONSOLE_FREE_HANDLE, CONSOLE_FULLSCREEN_NOPAINT, CONSOLE_INPUT_HANDLE, CONSOLE_NOTIFY_LAST_CLOSE, CONSOLE_VDM_REGISTERED, _CONSOLE_INFORMATION::ConsoleHandle, ConsoleHeapFree, CreateCtrlThread(), _CONSOLE_PROCESS_TERMINATION_RECORD::CtrlRoutine, CtrlRoutine, DereferenceIoHandleNoCheck(), FALSE, _CONSOLE_INFORMATION::Flags, FreeCommandHistory(), FreeCon(), FreeProcessData(), _HANDLE_DATA::HandleType, _CONSOLE_INFORMATION::hProcessLastNotifyClose, NT_SUCCESS, NtClose(), NTSTATUS(), NULL, _CONSOLE_PROCESS_TERMINATION_RECORD::ProcessHandle, _CONSOLE_INFORMATION::ProcessIdLastNotifyClose, _CONSOLE_INFORMATION::RefCount, RemoveProcessFromList(), RevalidateConsole(), Status, _CONSOLE_PROCESS_TERMINATION_RECORD::TerminateCount, TRUE, UnlockConsole(), UnregisterVDM(), and _CONSOLE_INFORMATION::VDMProcessId.

Referenced by ConsoleClientConnectRoutine(), ConsoleClientDisconnectRoutine(), SrvFreeConsole(), and WndProc().

01360 { 01361 ULONG i; 01362 PHANDLE_DATA HandleData; 01363 NTSTATUS Status; 01364 PCONSOLE_INFORMATION Console; 01365 01366 Status = RevalidateConsole(ProcessData->ConsoleHandle, &Console); 01367 01368 // 01369 // If this process isn't using the console, error. 01370 // 01371 01372 if (!NT_SUCCESS(Status)) { 01373 ASSERT(FALSE); 01374 return Status; 01375 } 01376 01377 if (Console->Flags & CONSOLE_NOTIFY_LAST_CLOSE) { 01378 if (Console->ProcessIdLastNotifyClose == ProcessId) { 01379 // if this process is the one who wants last close notification, 01380 // remove it. 01381 Console->Flags &= ~CONSOLE_NOTIFY_LAST_CLOSE; 01382 NtClose(Console->hProcessLastNotifyClose); 01383 } else if (ProcessData->RootProcess) { 01384 // notify the ntvdm process to terminate if the console root 01385 // process is going away. 01386 HANDLE ConsoleHandle; 01387 CONSOLE_PROCESS_TERMINATION_RECORD ProcessHandleList; 01388 01389 Console->Flags &= ~CONSOLE_NOTIFY_LAST_CLOSE; 01390 ConsoleHandle = Console->ConsoleHandle; 01391 ProcessHandleList.ProcessHandle = Console->hProcessLastNotifyClose; 01392 ProcessHandleList.TerminateCount = 0; 01393 ProcessHandleList.CtrlRoutine = CtrlRoutine; 01394 UnlockConsole(Console); 01395 CreateCtrlThread(&ProcessHandleList, 01396 1, 01397 NULL, 01398 SYSTEM_ROOT_CONSOLE_EVENT, 01399 TRUE); 01400 NtClose(ProcessHandleList.ProcessHandle); 01401 Status = RevalidateConsole(ConsoleHandle, &Console); 01402 ASSERT(NT_SUCCESS(Status)); 01403 if (!NT_SUCCESS(Status)) { 01404 return STATUS_SUCCESS; 01405 } 01406 } 01407 } 01408 01409 if (Console->VDMProcessId == ProcessId && 01410 (Console->Flags & CONSOLE_VDM_REGISTERED)) { 01411 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 01412 UnregisterVDM(Console); 01413 } 01414 01415 if (ProcessHandle != NULL) { 01416 RemoveProcessFromList(Console,ProcessHandle); 01417 FreeCommandHistory(Console,ProcessHandle); 01418 } 01419 01420 ASSERT(Console->RefCount); 01421 01422 // 01423 // close the process's handles. 01424 // 01425 01426 for (i=0;i<ProcessData->HandleTableSize;i++) { 01427 if (ProcessData->HandleTablePtr[i].HandleType != CONSOLE_FREE_HANDLE) { 01428 Status = DereferenceIoHandleNoCheck(ProcessData, 01429 (HANDLE) i, 01430 &HandleData 01431 ); 01432 ASSERT (NT_SUCCESS(Status)); 01433 if (HandleData->HandleType & CONSOLE_INPUT_HANDLE) { 01434 Status = CloseInputHandle(ProcessData,Console,HandleData,(HANDLE) i); 01435 } 01436 else { 01437 Status = CloseOutputHandle(ProcessData,Console,HandleData,(HANDLE) i,FALSE); 01438 } 01439 } 01440 } 01441 FreeProcessData(ProcessData); 01442 ProcessData->ConsoleHandle = NULL; 01443 01444 // 01445 // decrement the console reference count. free the console if it goes to 01446 // zero. 01447 // 01448 01449 Console->RefCount--; 01450 if (Console->RefCount == 0) { 01451 01452 #if defined(FE_IME) 01453 01454 PCONVERSIONAREA_INFORMATION ConvAreaInfo; 01455 PCONVERSIONAREA_INFORMATION ConvAreaInfoNext; 01456 01457 ConvAreaInfo = Console->ConsoleIme.ConvAreaRoot; 01458 while(ConvAreaInfo) { 01459 ConvAreaInfoNext = ConvAreaInfo->ConvAreaNext; 01460 FreeConvAreaScreenBuffer(ConvAreaInfo->ScreenBuffer); 01461 ConsoleHeapFree(ConvAreaInfo); 01462 ConvAreaInfo = ConvAreaInfoNext; 01463 } 01464 01465 if (Console->ConsoleIme.NumberOfConvAreaCompStr) { 01466 ConsoleHeapFree(Console->ConsoleIme.ConvAreaCompStr); 01467 } 01468 if (Console->ConsoleIme.CompStrData) { 01469 ConsoleHeapFree(Console->ConsoleIme.CompStrData); 01470 } 01471 #endif 01472 FreeCon(Console); 01473 } 01474 else { 01475 UnlockConsole(Console); 01476 } 01477 return( STATUS_SUCCESS ); 01478 }

VOID RemoveScreenBuffer IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo
 

Definition at line 1187 of file w32/ntcon/server/handle.c.

References ASSERT, _SCREEN_INFORMATION::Next, and NULL.

Referenced by CloseOutputHandle().

01194 : 01195 01196 This routine removes the screen buffer pointer from the console's 01197 list of screen buffers. 01198 01199 Arguments: 01200 01201 Console - Pointer to console information structure. 01202 01203 ScreenInfo - Pointer to screen information structure. 01204 01205 Return Value: 01206 01207 Note: 01208 01209 The console lock must be held when calling this routine. 01210 01211 --*/ 01212 01213 { 01214 PSCREEN_INFORMATION Prev,Cur; 01215 01216 if (ScreenInfo == Console->ScreenBuffers) { 01217 Console->ScreenBuffers = ScreenInfo->Next; 01218 return; 01219 } 01220 Prev = Cur = Console->ScreenBuffers; 01221 while (Cur != NULL) { 01222 if (ScreenInfo == Cur) 01223 break; 01224 Prev = Cur; 01225 Cur = Cur->Next; 01226 } 01227 ASSERT (Cur != NULL); 01228 if (Cur != NULL) { 01229 Prev->Next = Cur->Next; 01230 } 01231 }

NTSTATUS RemoveTextBufferFontInfo IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 952 of file w32/ntcon/server/misc.c.

References ConsoleHeapFree, _TEXT_BUFFER_FONT_INFO::NextTextBufferFont, and NULL.

Referenced by CreateScreenBuffer(), and FreeScreenBuffer().

00958 : 00959 00960 This routine all remove a font information in ListOfTextBufferFont. 00961 00962 Arguments: 00963 00964 Return Value: 00965 00966 --*/ 00967 00968 { 00969 PTEXT_BUFFER_FONT_INFO CurrentFont; 00970 00971 CurrentFont = ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont; 00972 00973 while (CurrentFont != NULL) { 00974 PTEXT_BUFFER_FONT_INFO NextFont; 00975 00976 NextFont = CurrentFont->NextTextBufferFont; 00977 ConsoleHeapFree(CurrentFont); 00978 00979 CurrentFont = NextFont; 00980 } 00981 00982 ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont = NULL; 00983 00984 return STATUS_SUCCESS; 00985 }

VOID ResetCommandHistory IN PCOMMAND_HISTORY  CommandHistory  ) 
 

Definition at line 4726 of file server/cmdline.c.

References CLE_RESET, and NULL.

Referenced by AddCommand().

04735 { 04736 if (CommandHistory == NULL) { 04737 return; 04738 } 04739 CommandHistory->LastDisplayed = CommandHistory->LastAdded; 04740 CommandHistory->Flags |= CLE_RESET; 04741 }

VOID ResizeCommandHistoryBuffers IN PCONSOLE_INFORMATION  Console,
IN UINT  NumCommands
 

Definition at line 4665 of file server/cmdline.c.

References CLE_ALLOCATED, _COOKED_READ_DATA::CommandHistory, History, ReallocCommandHistory(), and SHORT.

Referenced by PropertiesUpdate().

04669 { 04670 PCOMMAND_HISTORY History; 04671 PLIST_ENTRY ListHead, ListNext; 04672 #if defined(FE_SB) 04673 PCOOKED_READ_DATA CookedReadData; 04674 PCOMMAND_HISTORY NewHistory; 04675 #endif 04676 04677 Console->CommandHistorySize = (SHORT)NumCommands; 04678 04679 ListHead = &Console->CommandHistoryList; 04680 ListNext = ListHead->Flink; 04681 while (ListNext != ListHead) { 04682 History = CONTAINING_RECORD( ListNext, COMMAND_HISTORY, ListLink ); 04683 ListNext = ListNext->Flink; 04684 04685 #if defined(FE_SB) 04686 NewHistory = ReallocCommandHistory(Console, History, NumCommands); 04687 CookedReadData = Console->lpCookedReadData; 04688 if (CookedReadData && CookedReadData->CommandHistory == History) { 04689 CookedReadData->CommandHistory = NewHistory; 04690 } 04691 #else 04692 if (!(History->Flags & CLE_ALLOCATED)) { 04693 ReallocCommandHistory(Console, History, NumCommands); 04694 } 04695 #endif 04696 } 04697 }

NTSTATUS ResizeScreenBuffer IN PSCREEN_INFORMATION  ScreenInfo,
IN COORD  NewScreenSize,
IN BOOL  DoScrollBarUpdate
 

Definition at line 2231 of file output.c.

References ASSERT, _ATTR_PAIR::Attr, _ATTR_ROW::AttrPair, _ROW::AttrRow, _ATTR_ROW::Attrs, BOOL, CHAR, CONIME_NOTIFY_SCREENBUFFERSIZE, CONSOLE_IS_IME_ENABLED, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapReAlloc, CreateDbcsScreenBuffer(), DeleteDbcsScreenBuffer(), FALSE, FindAttrIndex(), INVALID_OLD_LENGTH, _ATTR_ROW::Length, _ATTR_PAIR::Length, MAKE_TAG, NT_SUCCESS, NULL, PBYTE, ResetTextFlags(), ROW, SCREEN_TAG, ScreenBufferSizeChange(), SetCursorPosition(), SetWindowSize(), SHORT, TRUE, UpdateScrollBars(), and UpdateWindow().

Referenced by ConvertToFullScreen(), ConvertToWindowed(), PropertiesUpdate(), SetScreenBufferFont(), and SrvSetConsoleScreenBufferSize().

02239 : 02240 02241 This routine resizes the screen buffer. 02242 02243 Arguments: 02244 02245 ScreenInfo - pointer to screen buffer info. 02246 02247 NewScreenSize - new size of screen. 02248 02249 Return Value: 02250 02251 --*/ 02252 02253 { 02254 SHORT i,j; 02255 BOOLEAN WindowMaximizedX,WindowMaximizedY; 02256 SHORT LimitX,LimitY; 02257 PWCHAR TextRows,TextRowPtr; 02258 BOOL UpdateWindow; 02259 SHORT TopRow,TopRowIndex; // new top row of screen buffer 02260 COORD CursorPosition; 02261 #if defined(FE_SB) 02262 DBCS_SCREEN_BUFFER NewDbcsScreenBuffer; 02263 PBYTE TextRowPtrA; 02264 #endif 02265 02266 // 02267 // Don't allow resize of graphics apps 02268 // 02269 02270 if (!(ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER)) { 02271 return STATUS_UNSUCCESSFUL; 02272 } 02273 02274 TextRows = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( SCREEN_TAG ),NewScreenSize.X*NewScreenSize.Y*sizeof(WCHAR)); 02275 if (TextRows == NULL) { 02276 return STATUS_NO_MEMORY; 02277 } 02278 #if defined(FE_SB) 02279 if (! CreateDbcsScreenBuffer(ScreenInfo->Console,NewScreenSize,&NewDbcsScreenBuffer)) 02280 { 02281 ConsoleHeapFree(TextRows); 02282 return STATUS_NO_MEMORY; 02283 } 02284 #endif 02285 LimitX = (NewScreenSize.X < ScreenInfo->ScreenBufferSize.X) ? 02286 NewScreenSize.X : ScreenInfo->ScreenBufferSize.X; 02287 LimitY = (NewScreenSize.Y < ScreenInfo->ScreenBufferSize.Y) ? 02288 NewScreenSize.Y : ScreenInfo->ScreenBufferSize.Y; 02289 TopRow = 0; 02290 if (NewScreenSize.Y <= ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y) { 02291 TopRow += ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y - NewScreenSize.Y + 1; 02292 } 02293 TopRowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+TopRow) % ScreenInfo->ScreenBufferSize.Y; 02294 if (NewScreenSize.Y != ScreenInfo->ScreenBufferSize.Y) { 02295 PROW Temp; 02296 SHORT NumToCopy,NumToCopy2; 02297 02298 // 02299 // resize ROWs array. first alloc a new ROWs array. then copy the old 02300 // one over, resetting the FirstRow. 02301 // 02302 // 02303 02304 Temp = (PROW)ConsoleHeapAlloc(MAKE_TAG( SCREEN_TAG ),NewScreenSize.Y*sizeof(ROW)); 02305 if (Temp == NULL) { 02306 ConsoleHeapFree(TextRows); 02307 #if defined(FE_SB) 02308 DeleteDbcsScreenBuffer(&NewDbcsScreenBuffer); 02309 #endif 02310 return STATUS_NO_MEMORY; 02311 } 02312 NumToCopy = ScreenInfo->ScreenBufferSize.Y-TopRowIndex; 02313 if (NumToCopy > NewScreenSize.Y) 02314 NumToCopy = NewScreenSize.Y; 02315 RtlCopyMemory(Temp,&ScreenInfo->BufferInfo.TextInfo.Rows[TopRowIndex],NumToCopy*sizeof(ROW)); 02316 if (TopRowIndex!=0 && NumToCopy != NewScreenSize.Y) { 02317 NumToCopy2 = TopRowIndex; 02318 if (NumToCopy2 > (NewScreenSize.Y-NumToCopy)) 02319 NumToCopy2 = NewScreenSize.Y-NumToCopy; 02320 RtlCopyMemory(&Temp[NumToCopy], 02321 ScreenInfo->BufferInfo.TextInfo.Rows, 02322 NumToCopy2*sizeof(ROW) 02323 ); 02324 } 02325 for (i=0;i<LimitY;i++) { 02326 if (Temp[i].AttrRow.Length == 1) { 02327 Temp[i].AttrRow.Attrs = &Temp[i].AttrRow.AttrPair; 02328 } 02329 } 02330 02331 // 02332 // if the new screen buffer has fewer rows than the existing one, 02333 // free the extra rows. if the new screen buffer has more rows 02334 // than the existing one, allocate new rows. 02335 // 02336 02337 if (NewScreenSize.Y < ScreenInfo->ScreenBufferSize.Y) { 02338 i = (TopRowIndex+NewScreenSize.Y) % ScreenInfo->ScreenBufferSize.Y; 02339 for (j=NewScreenSize.Y;j<ScreenInfo->ScreenBufferSize.Y;j++) { 02340 if (ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length > 1) { 02341 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs); 02342 } 02343 if (++i == ScreenInfo->ScreenBufferSize.Y) { 02344 i = 0; 02345 } 02346 } 02347 } else if (NewScreenSize.Y > ScreenInfo->ScreenBufferSize.Y) { 02348 for (i=ScreenInfo->ScreenBufferSize.Y;i<NewScreenSize.Y;i++) { 02349 Temp[i].AttrRow.Length = 1; 02350 Temp[i].AttrRow.AttrPair.Length = NewScreenSize.X; 02351 Temp[i].AttrRow.AttrPair.Attr = ScreenInfo->Attributes; 02352 Temp[i].AttrRow.Attrs = &Temp[i].AttrRow.AttrPair; 02353 } 02354 } 02355 ScreenInfo->BufferInfo.TextInfo.FirstRow = 0; 02356 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.Rows); 02357 ScreenInfo->BufferInfo.TextInfo.Rows = Temp; 02358 } 02359 02360 // 02361 // Realloc each row. any horizontal growth results in the last 02362 // attribute in a row getting extended. 02363 // 02364 #if defined(FE_SB) 02365 TextRowPtrA=NewDbcsScreenBuffer.KAttrRows; 02366 #endif 02367 for (i=0,TextRowPtr=TextRows;i<LimitY;i++,TextRowPtr+=NewScreenSize.X) 02368 { 02369 RtlCopyMemory(TextRowPtr, 02370 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Chars, 02371 LimitX*sizeof(WCHAR)); 02372 #if defined(FE_SB) 02373 if (TextRowPtrA) { 02374 RtlCopyMemory(TextRowPtrA, 02375 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.KAttrs, 02376 LimitX*sizeof(CHAR)); 02377 } 02378 #endif 02379 for (j=ScreenInfo->ScreenBufferSize.X;j<NewScreenSize.X;j++) { 02380 TextRowPtr[j] = (WCHAR)' '; 02381 } 02382 02383 if (ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Right > NewScreenSize.X) { 02384 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.OldRight = INVALID_OLD_LENGTH; 02385 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Right = NewScreenSize.X; 02386 } 02387 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Chars = TextRowPtr; 02388 #if defined(FE_SB) 02389 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.KAttrs = TextRowPtrA; 02390 if (TextRowPtrA) { 02391 if (NewScreenSize.X > ScreenInfo->ScreenBufferSize.X) 02392 RtlZeroMemory(TextRowPtrA+ScreenInfo->ScreenBufferSize.X, 02393 NewScreenSize.X-ScreenInfo->ScreenBufferSize.X); 02394 TextRowPtrA+=NewScreenSize.X; 02395 } 02396 #endif 02397 } 02398 for (;i<NewScreenSize.Y;i++,TextRowPtr+=NewScreenSize.X) 02399 { 02400 for (j=0;j<NewScreenSize.X;j++) { 02401 TextRowPtr[j] = (WCHAR)' '; 02402 } 02403 #if defined(FE_SB) 02404 if (TextRowPtrA) { 02405 RtlZeroMemory(TextRowPtrA, NewScreenSize.X); 02406 } 02407 #endif 02408 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Chars = TextRowPtr; 02409 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.OldLeft = INVALID_OLD_LENGTH; 02410 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.OldRight = INVALID_OLD_LENGTH; 02411 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Left = NewScreenSize.X; 02412 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.Right = 0; 02413 #if defined(FE_SB) 02414 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.KAttrs = TextRowPtrA; 02415 if (TextRowPtrA) { 02416 TextRowPtrA+=NewScreenSize.X; 02417 } 02418 #endif 02419 } 02420 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.TextRows); 02421 ScreenInfo->BufferInfo.TextInfo.TextRows = TextRows; 02422 #if defined(FE_SB) 02423 DeleteDbcsScreenBuffer(&ScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer); 02424 ScreenInfo->BufferInfo.TextInfo.DbcsScreenBuffer = NewDbcsScreenBuffer; 02425 #endif 02426 02427 if (NewScreenSize.X != ScreenInfo->ScreenBufferSize.X) { 02428 for (i=0;i<LimitY;i++) { 02429 PATTR_PAIR IndexedAttr; 02430 SHORT CountOfAttr; 02431 02432 if (NewScreenSize.X > ScreenInfo->ScreenBufferSize.X) { 02433 FindAttrIndex(ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs, 02434 (SHORT)(ScreenInfo->ScreenBufferSize.X-1), 02435 &IndexedAttr, 02436 &CountOfAttr 02437 ); 02438 ASSERT (IndexedAttr <= 02439 &ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs[ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length-1]); 02440 IndexedAttr->Length += NewScreenSize.X - ScreenInfo->ScreenBufferSize.X; 02441 } 02442 else { 02443 02444 FindAttrIndex(ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs, 02445 (SHORT)(NewScreenSize.X-1), 02446 &IndexedAttr, 02447 &CountOfAttr 02448 ); 02449 IndexedAttr->Length -= CountOfAttr-1; 02450 if (ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length != 1) { 02451 ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length = (SHORT)(IndexedAttr - ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs + 1); 02452 if (ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length != 1) { 02453 ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs = (PATTR_PAIR)ConsoleHeapReAlloc(MAKE_TAG( SCREEN_TAG ),ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs, 02454 ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Length * sizeof(ATTR_PAIR)); 02455 } 02456 else { 02457 ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.AttrPair = *IndexedAttr; 02458 ConsoleHeapFree(ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs); 02459 ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.Attrs = &ScreenInfo->BufferInfo.TextInfo.Rows[i].AttrRow.AttrPair; 02460 } 02461 } 02462 } 02463 } 02464 } 02465 02466 // 02467 // if the screen buffer is resized smaller than the saved 02468 // window size, shrink the saved window size. 02469 // 02470 #ifdef i386 02471 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 02472 if (NewScreenSize.X < ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.X) { 02473 ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.X = NewScreenSize.X; 02474 } 02475 if (NewScreenSize.Y < ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.Y) { 02476 ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.Y = NewScreenSize.Y; 02477 } 02478 ScreenInfo->BufferInfo.TextInfo.WindowedScreenSize = NewScreenSize; 02479 } 02480 #endif 02481 02482 UpdateWindow = FALSE; 02483 02484 // 02485 // if the screen buffer shrunk beyond the boundaries of the window, 02486 // adjust the window origin. 02487 // 02488 02489 if (NewScreenSize.X > CONSOLE_WINDOW_SIZE_X(ScreenInfo)) { 02490 if (ScreenInfo->Window.Right >= NewScreenSize.X) { 02491 ScreenInfo->Window.Left -= ScreenInfo->Window.Right - NewScreenSize.X + 1; 02492 ScreenInfo->Window.Right -= ScreenInfo->Window.Right - NewScreenSize.X + 1; 02493 UpdateWindow = TRUE; 02494 } 02495 } else { 02496 ScreenInfo->Window.Left = 0; 02497 ScreenInfo->Window.Right = NewScreenSize.X - 1; 02498 UpdateWindow = TRUE; 02499 } 02500 if (NewScreenSize.Y > CONSOLE_WINDOW_SIZE_Y(ScreenInfo)) { 02501 if (ScreenInfo->Window.Bottom >= NewScreenSize.Y) { 02502 ScreenInfo->Window.Top -= ScreenInfo->Window.Bottom - NewScreenSize.Y + 1; 02503 ScreenInfo->Window.Bottom -= ScreenInfo->Window.Bottom - NewScreenSize.Y + 1; 02504 UpdateWindow = TRUE; 02505 } 02506 } else { 02507 ScreenInfo->Window.Top = 0; 02508 ScreenInfo->Window.Bottom = NewScreenSize.Y - 1; 02509 UpdateWindow = TRUE; 02510 } 02511 02512 #if defined(FE_SB) 02513 // Should be sets ScreenBufferSize before calls SetCursorPosition 02514 // because SetCursorPosition refer ScreenBufferSize. 02515 // Also, FE version refer in InvertPixels. 02516 // 02517 // kkntbug:11311 02518 ScreenInfo->ScreenBufferSize = NewScreenSize; 02519 #endif 02520 02521 // 02522 // adjust cursor position if it's no longer with screen buffer 02523 // 02524 02525 CursorPosition=ScreenInfo->BufferInfo.TextInfo.CursorPosition; 02526 if (CursorPosition.X >= NewScreenSize.X) { 02527 if (ScreenInfo->OutputMode & ENABLE_WRAP_AT_EOL_OUTPUT) { 02528 CursorPosition.X = 0; 02529 CursorPosition.Y += 1; 02530 } else { 02531 CursorPosition.X = NewScreenSize.X-1; 02532 } 02533 } 02534 if (CursorPosition.Y >= NewScreenSize.Y) { 02535 CursorPosition.Y = NewScreenSize.Y-1; 02536 } 02537 #if defined(FE_SB) 02538 // set cursor position Y is ZERO when expand screen buffer with IME open mode 02539 // from screen buffer is one line mode. 02540 // Because, One line screen buffer mode and IME open mode is set -1 as cursor position Y. 02541 if (ScreenInfo->Console->InputBuffer.ImeMode.Open && CursorPosition.Y < 0) { 02542 CursorPosition.Y = 0; 02543 } 02544 #endif 02545 if (CursorPosition.X != ScreenInfo->BufferInfo.TextInfo.CursorPosition.X || 02546 CursorPosition.Y != ScreenInfo->BufferInfo.TextInfo.CursorPosition.Y) { 02547 SetCursorPosition(ScreenInfo, 02548 CursorPosition, 02549 FALSE 02550 ); 02551 } 02552 02553 ASSERT (ScreenInfo->Window.Left >= 0); 02554 ASSERT (ScreenInfo->Window.Right < NewScreenSize.X); 02555 ASSERT (ScreenInfo->Window.Top >= 0); 02556 ASSERT (ScreenInfo->Window.Bottom < NewScreenSize.Y); 02557 02558 ScreenInfo->ScreenBufferSize = NewScreenSize; 02559 ResetTextFlags(ScreenInfo,0,(SHORT)(ScreenInfo->ScreenBufferSize.Y-1)); 02560 WindowMaximizedX = (CONSOLE_WINDOW_SIZE_X(ScreenInfo) == 02561 ScreenInfo->ScreenBufferSize.X); 02562 WindowMaximizedY = (CONSOLE_WINDOW_SIZE_Y(ScreenInfo) == 02563 ScreenInfo->ScreenBufferSize.Y); 02564 02565 #if defined(FE_IME) 02566 if (CONSOLE_IS_IME_ENABLED()) { 02567 if (!NT_SUCCESS(ConsoleImeMessagePump(ScreenInfo->Console, 02568 CONIME_NOTIFY_SCREENBUFFERSIZE, 02569 (WPARAM)ScreenInfo->Console->ConsoleHandle, 02570 (LPARAM)MAKELPARAM(NewScreenSize.X, NewScreenSize.Y) 02571 ))) { 02572 return STATUS_INVALID_HANDLE; 02573 } 02574 } 02575 02576 if ( (! ScreenInfo->ConvScreenInfo) && 02577 (CONSOLE_IS_DBCS_OUTPUTCP(ScreenInfo->Console))) 02578 { 02579 if (!NT_SUCCESS(ConsoleImeResizeModeSystemScreenBuffer(ScreenInfo->Console,NewScreenSize)) || 02580 !NT_SUCCESS(ConsoleImeResizeCompStrScreenBuffer(ScreenInfo->Console,NewScreenSize))) { 02581 /* 02582 * If something went wrong, just bail out. 02583 */ 02584 return STATUS_INVALID_HANDLE; 02585 } 02586 } 02587 #endif // FE_IME 02588 if (ScreenInfo->WindowMaximizedX != WindowMaximizedX || 02589 ScreenInfo->WindowMaximizedY != WindowMaximizedY) { 02590 ScreenInfo->WindowMaximizedX = WindowMaximizedX; 02591 ScreenInfo->WindowMaximizedY = WindowMaximizedY; 02592 UpdateWindow = TRUE; 02593 } 02594 if (UpdateWindow) { 02595 SetWindowSize(ScreenInfo); 02596 } 02597 02598 if (DoScrollBarUpdate) { 02599 UpdateScrollBars(ScreenInfo); 02600 } 02601 if (ScreenInfo->Console->InputBuffer.InputMode & ENABLE_WINDOW_INPUT) { 02602 ScreenBufferSizeChange(ScreenInfo,ScreenInfo->ScreenBufferSize); 02603 } 02604 02605 return STATUS_SUCCESS; 02606 }

NTSTATUS ResizeWindow IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  WindowDimensions,
IN BOOL  DoScrollBarUpdate
 

Definition at line 3858 of file output.c.

References ACTIVE_SCREEN_BUFFER, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, TEXT_VALID_HINT, and UpdateScrollBars().

Referenced by ConvertToWindowed(), and SrvSetConsoleWindowInfo().

03866 : 03867 03868 This routine changes the console data structures to reflect the specified 03869 window size change. it does not call the user component to update 03870 the screen. 03871 03872 Arguments: 03873 03874 ScreenInformation - the new screen buffer. 03875 03876 dwWindowSize - the initial size of screen buffer's window. 03877 03878 nFont - the initial font to generate text with. 03879 03880 dwScreenBufferSize - the initial size of the screen buffer. 03881 03882 Return Value: 03883 03884 03885 --*/ 03886 03887 { 03888 // 03889 // make sure there's something to do 03890 // 03891 03892 if (RtlEqualMemory(&ScreenInfo->Window, WindowDimensions, sizeof(SMALL_RECT))) { 03893 return STATUS_SUCCESS; 03894 } 03895 03896 if (WindowDimensions->Left < 0) { 03897 WindowDimensions->Right -= WindowDimensions->Left; 03898 WindowDimensions->Left = 0; 03899 } 03900 if (WindowDimensions->Top < 0) { 03901 WindowDimensions->Bottom -= WindowDimensions->Top; 03902 WindowDimensions->Top = 0; 03903 } 03904 03905 if (WindowDimensions->Right >= ScreenInfo->ScreenBufferSize.X) { 03906 WindowDimensions->Right = ScreenInfo->ScreenBufferSize.X; 03907 } 03908 if (WindowDimensions->Bottom >= ScreenInfo->ScreenBufferSize.Y) { 03909 WindowDimensions->Bottom = ScreenInfo->ScreenBufferSize.Y; 03910 } 03911 03912 ScreenInfo->Window = *WindowDimensions; 03913 ScreenInfo->WindowMaximizedX = (CONSOLE_WINDOW_SIZE_X(ScreenInfo) == ScreenInfo->ScreenBufferSize.X); 03914 ScreenInfo->WindowMaximizedY = (CONSOLE_WINDOW_SIZE_Y(ScreenInfo) == ScreenInfo->ScreenBufferSize.Y); 03915 03916 if (DoScrollBarUpdate) { 03917 UpdateScrollBars(ScreenInfo); 03918 } 03919 03920 if (!(ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER)) { 03921 return STATUS_SUCCESS; 03922 } 03923 03924 if (ACTIVE_SCREEN_BUFFER(ScreenInfo)) { 03925 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 03926 } 03927 03928 #ifdef i386 03929 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 03930 03931 // 03932 // keep mouse pointer on screen 03933 // 03934 03935 if (ScreenInfo->BufferInfo.TextInfo.MousePosition.X < WindowDimensions->Left) { 03936 ScreenInfo->BufferInfo.TextInfo.MousePosition.X = WindowDimensions->Left; 03937 } else if (ScreenInfo->BufferInfo.TextInfo.MousePosition.X > WindowDimensions->Right) { 03938 ScreenInfo->BufferInfo.TextInfo.MousePosition.X = WindowDimensions->Right; 03939 } 03940 03941 if (ScreenInfo->BufferInfo.TextInfo.MousePosition.Y < WindowDimensions->Top) { 03942 ScreenInfo->BufferInfo.TextInfo.MousePosition.Y = WindowDimensions->Top; 03943 } else if (ScreenInfo->BufferInfo.TextInfo.MousePosition.Y > WindowDimensions->Bottom) { 03944 ScreenInfo->BufferInfo.TextInfo.MousePosition.Y = WindowDimensions->Bottom; 03945 } 03946 } 03947 #endif 03948 03949 return(STATUS_SUCCESS); 03950 }

NTSTATUS RetrieveCommand IN PCOMMAND_HISTORY  CommandHistory,
IN WORD  VirtualKeyCode,
IN PWCHAR  Buffer,
IN ULONG  BufferSize,
OUT PULONG  CommandSize
 

Definition at line 4834 of file server/cmdline.c.

References ASSERT, Buffer, BufferSize, CLE_ALLOCATED, CLE_RESET, COMMAND_IND_NEXT, COMMAND_IND_PREV, NULL, and RetrieveNthCommand().

Referenced by ProcessCommandLine().

04841 { 04842 04843 if (CommandHistory == NULL) { 04844 return STATUS_UNSUCCESSFUL; 04845 } 04846 ASSERT(CommandHistory->Flags & CLE_ALLOCATED); 04847 if (CommandHistory->NumberOfCommands == 0) { 04848 return STATUS_UNSUCCESSFUL; 04849 } 04850 if (CommandHistory->NumberOfCommands == 1) { 04851 CommandHistory->LastDisplayed = 0; 04852 } 04853 else if (VirtualKeyCode == VK_UP) { 04854 04855 // 04856 // if this is the first time for this read that a command has 04857 // been retrieved, return the current command. otherwise, return 04858 // the previous command. 04859 // 04860 04861 if (CommandHistory->Flags & CLE_RESET) { 04862 CommandHistory->Flags &= ~CLE_RESET; 04863 } else { 04864 COMMAND_IND_PREV(CommandHistory->LastDisplayed, CommandHistory); 04865 } 04866 } 04867 else { 04868 COMMAND_IND_NEXT(CommandHistory->LastDisplayed, CommandHistory); 04869 } 04870 return RetrieveNthCommand(CommandHistory, 04871 CommandHistory->LastDisplayed, 04872 Buffer, 04873 BufferSize, 04874 CommandSize 04875 ); 04876 }

VOID RetrieveKeyInfo IN HWND  hWnd,
OUT PWORD  pwVirtualKeyCode,
OUT PWORD  pwVirtualScanCode,
IN BOOL  FreeKeyInfo
 

Definition at line 1609 of file ntcon/server/input.c.

References CONSOLE_FREE_KEY_INFO, CONSOLE_MAX_KEY_INFO, ConsoleKeyInfo, _CONSOLE_KEY_INFO::hWnd, hWnd, MapVirtualKey(), _CONSOLE_KEY_INFO::wVirtualKeyCode, and _CONSOLE_KEY_INFO::wVirtualScanCode.

Referenced by HandleKeyEvent().

01615 { 01616 int i; 01617 01618 for (i=0;i<CONSOLE_MAX_KEY_INFO;i++) { 01619 if (ConsoleKeyInfo[i].hWnd == hWnd) { 01620 break; 01621 } 01622 } 01623 if (i!=CONSOLE_MAX_KEY_INFO) { 01624 *pwVirtualKeyCode = ConsoleKeyInfo[i].wVirtualKeyCode; 01625 *pwVirtualScanCode = ConsoleKeyInfo[i].wVirtualScanCode; 01626 if (FreeKeyInfo) 01627 ConsoleKeyInfo[i].hWnd = CONSOLE_FREE_KEY_INFO; 01628 } else { 01629 *pwVirtualKeyCode = (WORD)MapVirtualKey(*pwVirtualScanCode, 3); 01630 } 01631 }

NTSTATUS RevalidateConsole IN HANDLE  ConsoleHandle,
OUT PCONSOLE_INFORMATION Console
 

Definition at line 1686 of file w32/ntcon/server/handle.c.

References CONSOLE_IN_DESTRUCTION, CONSOLE_TERMINATING, DereferenceConsoleHandle(), DestroyConsole(), EXCEPTION_EXECUTE_HANDLER, LockConsole, LockConsoleHandleTable, NT_SUCCESS, NTSTATUS(), NULL, Status, UnlockConsole(), and UnlockConsoleHandleTable.

Referenced by ApiPreamble(), ConsoleAddProcessRoutine(), ConsoleClientConnectRoutine(), ConsoleClientShutdown(), ConsoleSetActiveWindow(), ConsoleWindowProc(), GetThreadConsoleDesktop(), ProcessCreateConsoleWindow(), RemoveConsole(), SrvAllocConsole(), and UnlockConsole().

01690 { 01691 NTSTATUS Status; 01692 01693 LockConsoleHandleTable(); 01694 Status = DereferenceConsoleHandle(ConsoleHandle, 01695 Console 01696 ); 01697 if (!NT_SUCCESS(Status)) { 01698 UnlockConsoleHandleTable(); 01699 return Status; 01700 } 01701 01702 // 01703 // The WaitCount ensures the console won't go away between the time 01704 // we unlock the console handle table and we lock the console. 01705 // 01706 01707 InterlockedIncrement(&(*Console)->WaitCount); 01708 UnlockConsoleHandleTable(); 01709 try { 01710 LockConsole(*Console); 01711 } except (EXCEPTION_EXECUTE_HANDLER) { 01712 InterlockedDecrement(&(*Console)->WaitCount); 01713 return GetExceptionCode(); 01714 } 01715 InterlockedDecrement(&(*Console)->WaitCount); 01716 01717 // 01718 // If the console was marked for destruction while we were waiting to 01719 // lock it, try to destroy it and return. 01720 // 01721 01722 if ((*Console)->Flags & CONSOLE_IN_DESTRUCTION) { 01723 DestroyConsole(*Console); 01724 *Console = NULL; 01725 return STATUS_INVALID_HANDLE; 01726 } 01727 01728 // 01729 // If the console was marked for termination while we were waiting to 01730 // lock it, bail out. 01731 // 01732 01733 if ((*Console)->Flags & CONSOLE_TERMINATING) { 01734 UnlockConsole(*Console); 01735 *Console = NULL; 01736 return STATUS_PROCESS_IS_TERMINATING; 01737 } 01738 01739 return Status; 01740 }

__inline LPWSTR SCR_FACENAME PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 112 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), PropertiesDlgShow(), SetFont(), and SetScreenBufferFont().

00112 { 00113 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.FaceName; 00114 }

__inline BYTE SCR_FAMILY PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 104 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo, and BYTE.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), CreateScreenBuffer(), PropertiesDlgShow(), SetFont(), and SetScreenBufferFont().

00104 { 00105 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.Family; 00106 }

__inline UINT SCR_FONTCODEPAGE PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 124 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo, and UINT.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), SetFont(), SetRAMFontCodePage(), and SetScreenBufferFont().

00124 { 00125 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.FontCodePage; 00126 }

__inline DWORD SCR_FONTNUMBER PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 108 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo, and DWORD.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), CreateScreenBuffer(), GetCurrentFont(), PropertiesDlgShow(), SetFont(), and SetScreenBufferFont().

00108 { 00109 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.FontNumber; 00110 }

__inline COORD SCR_FONTSIZE PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 116 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo.

Referenced by ConsoleWindowProc(), ConvertToFullScreen(), ConvertToWindowed(), CreateScreenBuffer(), CreateWindowsWindow(), CursorTimerRoutine(), GetAvailableFonts(), GetWindowLimits(), HandleMouseEvent(), InternalSetWindowSize(), InvertPixels(), MyInvert(), ProcessResizeWindow(), PropertiesDlgShow(), PropertiesUpdate(), ScrollIfNecessary(), ScrollScreen(), SetCursorInformation(), SetFont(), SetScreenBufferFont(), SetWindowOrigin(), SrvGetLargestConsoleWindowSize(), StreamScrollRegion(), WWSB_ConsolePolyTextOut(), and WWSB_WriteRegionToScreen().

00116 { 00117 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.FontSize; 00118 }

__inline LONG SCR_FONTWEIGHT PSCREEN_INFORMATION  pScreen  ) 
 

Definition at line 120 of file consrv.h.

References _SCREEN_INFORMATION::BufferInfo.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), PropertiesDlgShow(), SetFont(), and SetScreenBufferFont().

00120 { 00121 return pScreen->BufferInfo.TextInfo.CurrentTextBufferFont.Weight; 00122 }

NTSTATUS ScrollRegion IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  ScrollRectangle,
IN PSMALL_RECT ClipRectangle  OPTIONAL,
IN COORD  DestinationOrigin,
IN CHAR_INFO  Fill
 

VOID ScrollScreen IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  ScrollRect,
IN PSMALL_RECT  MergeRect,
IN COORD  TargetPoint
 

Definition at line 2737 of file output.c.

References ACTIVE_SCREEN_BUFFER, ASSERT, BOOL, BYTE, CONSOLE_IS_ICONIC, CONSOLE_NO_WINDOW, CONSOLE_TEXTMODE_BUFFER, DBGOUTPUT, ghrgnScroll, LockScrollBuffer, NULL, SCR_FONTSIZE(), ScrollDC(), SCROLLDC_CALL, SHORT, UnlockScrollBuffer, UpdateComplexRegion(), and WriteToScreen.

Referenced by ScrollRegion().

02743 { 02744 RECT ScrollRectGdi; 02745 SMALL_RECT UpdateRegion; 02746 COORD FontSize; 02747 BOOL Success; 02748 RECT BoundingBox; 02749 #if defined(FE_SB) 02750 BYTE fBisect = 0; 02751 SMALL_RECT UpdateRect; 02752 SMALL_RECT TmpBisect; 02753 #endif 02754 02755 DBGOUTPUT(("ScrollScreen\n")); 02756 if (!ACTIVE_SCREEN_BUFFER(ScreenInfo)) { 02757 return; 02758 } 02759 if (ScreenInfo->Console->FullScreenFlags == 0 && 02760 !(ScreenInfo->Console->Flags & (CONSOLE_IS_ICONIC | CONSOLE_NO_WINDOW))) { 02761 #if defined(FE_SB) 02762 if (ScreenInfo->BisectFlag){ 02763 SMALL_RECT RedrawRect; 02764 if (ScrollRect->Top < TargetPoint.Y){ 02765 RedrawRect.Top = ScrollRect->Top; 02766 RedrawRect.Bottom = TargetPoint.Y+(ScrollRect->Bottom-ScrollRect->Top); 02767 } 02768 else{ 02769 RedrawRect.Top = TargetPoint.Y; 02770 RedrawRect.Bottom = ScrollRect->Bottom; 02771 } 02772 if (ScrollRect->Left < TargetPoint.X){ 02773 RedrawRect.Left = ScrollRect->Left; 02774 RedrawRect.Right = TargetPoint.X+(ScrollRect->Right-ScrollRect->Left); 02775 } 02776 else{ 02777 RedrawRect.Left = TargetPoint.X; 02778 RedrawRect.Right = ScrollRect->Right; 02779 } 02780 WriteToScreen(ScreenInfo,&RedrawRect); 02781 } 02782 else{ 02783 #endif 02784 ScrollRectGdi.left = ScrollRect->Left-ScreenInfo->Window.Left; 02785 ScrollRectGdi.right = (ScrollRect->Right-ScreenInfo->Window.Left+1); 02786 ScrollRectGdi.top = ScrollRect->Top-ScreenInfo->Window.Top; 02787 ScrollRectGdi.bottom = (ScrollRect->Bottom-ScreenInfo->Window.Top+1); 02788 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 02789 FontSize = SCR_FONTSIZE(ScreenInfo); 02790 ScrollRectGdi.left *= FontSize.X; 02791 ScrollRectGdi.right *= FontSize.X; 02792 ScrollRectGdi.top *= FontSize.Y; 02793 ScrollRectGdi.bottom *= FontSize.Y; 02794 ASSERT (ScreenInfo->BufferInfo.TextInfo.UpdatingScreen>0); 02795 } else { 02796 FontSize.X = 1; 02797 FontSize.Y = 1; 02798 } 02799 SCROLLDC_CALL; 02800 LockScrollBuffer(); 02801 Success = (int)ScrollDC(ScreenInfo->Console->hDC, 02802 (TargetPoint.X-ScrollRect->Left)*FontSize.X, 02803 (TargetPoint.Y-ScrollRect->Top)*FontSize.Y, 02804 &ScrollRectGdi, 02805 NULL, 02806 ghrgnScroll, 02807 NULL); 02808 if (Success) { 02809 /* 02810 * Fetch our rectangles. If this is a simple rect then 02811 * we have already retrieved the rectangle. Otherwise 02812 * we need to call gdi to get the rectangles. We are 02813 * optimzied for speed rather than size. 02814 */ 02815 switch (GetRgnBox(ghrgnScroll, &BoundingBox)) { 02816 case SIMPLEREGION: 02817 UpdateRegion.Left = (SHORT)((BoundingBox.left / FontSize.X) + \ 02818 ScreenInfo->Window.Left); 02819 UpdateRegion.Right = (SHORT)(((BoundingBox.right-1) / FontSize.X) + \ 02820 ScreenInfo->Window.Left); 02821 UpdateRegion.Top = (SHORT)((BoundingBox.top / FontSize.Y) + \ 02822 ScreenInfo->Window.Top); 02823 UpdateRegion.Bottom = (SHORT)(((BoundingBox.bottom-1) / FontSize.Y) + \ 02824 ScreenInfo->Window.Top); 02825 #if defined(FE_SB) 02826 fBisect = ScreenInfo->BisectFlag; 02827 #endif 02828 WriteToScreen(ScreenInfo, &UpdateRegion); 02829 break; 02830 case COMPLEXREGION: 02831 UpdateComplexRegion(ScreenInfo, FontSize); 02832 break; 02833 } 02834 02835 if (MergeRect) { 02836 #if defined(FE_SB) 02837 if (fBisect) 02838 ScreenInfo->BisectFlag = fBisect; 02839 else 02840 fBisect = ScreenInfo->BisectFlag; 02841 #endif 02842 WriteToScreen(ScreenInfo, MergeRect); 02843 } 02844 #if defined(FE_SB) 02845 if (CONSOLE_IS_DBCS_OUTPUTCP(ScreenInfo->Console)) { 02846 UpdateRect.Left = TargetPoint.X; 02847 UpdateRect.Right = ScrollRect->Right + (TargetPoint.X-ScrollRect->Left); 02848 UpdateRect.Top = TargetPoint.Y; 02849 UpdateRect.Bottom = ScrollRect->Bottom + (TargetPoint.Y-ScrollRect->Top); 02850 if (UpdateRect.Left && 02851 UpdateRect.Right+1 < ScreenInfo->ScreenBufferSize.X && 02852 UpdateRect.Right-UpdateRect.Left <= 2) { 02853 TmpBisect.Left = UpdateRect.Left-1; 02854 TmpBisect.Right = UpdateRect.Right+1; 02855 TmpBisect.Top = UpdateRect.Top; 02856 TmpBisect.Bottom = UpdateRect.Bottom; 02857 WriteToScreen(ScreenInfo, &TmpBisect); 02858 } 02859 else { 02860 if (UpdateRect.Left) { 02861 TmpBisect.Left = UpdateRect.Left-1; 02862 TmpBisect.Right = UpdateRect.Left; 02863 TmpBisect.Top = UpdateRect.Top; 02864 TmpBisect.Bottom = UpdateRect.Bottom; 02865 WriteToScreen(ScreenInfo, &TmpBisect); 02866 } 02867 if (UpdateRect.Right+1 < ScreenInfo->ScreenBufferSize.X) { 02868 TmpBisect.Left = UpdateRect.Right; 02869 TmpBisect.Right = UpdateRect.Right+1; 02870 TmpBisect.Top = UpdateRect.Top; 02871 TmpBisect.Bottom = UpdateRect.Bottom; 02872 WriteToScreen(ScreenInfo, &TmpBisect); 02873 } 02874 } 02875 } 02876 #endif 02877 } else { 02878 #if defined(FE_SB) 02879 if (fBisect) 02880 ScreenInfo->BisectFlag = fBisect; 02881 else 02882 fBisect = ScreenInfo->BisectFlag; 02883 #endif 02884 WriteToScreen(ScreenInfo, &ScreenInfo->Window); 02885 } 02886 UnlockScrollBuffer(); 02887 #if defined(FE_SB) 02888 } 02889 #endif 02890 } 02891 #ifdef i386 02892 else if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 02893 #if defined(FE_SB) 02894 if (CONSOLE_IS_DBCS_OUTPUTCP(ScreenInfo->Console)) { 02895 if (! ScreenInfo->ConvScreenInfo) { 02896 if (ScreenInfo->Console->CurrentScreenBuffer == ScreenInfo) { 02897 ScrollHW(ScreenInfo, 02898 ScrollRect, 02899 MergeRect, 02900 TargetPoint 02901 ); 02902 } 02903 } 02904 else if (ScreenInfo->Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 02905 ScrollHW(ScreenInfo, 02906 ScrollRect, 02907 MergeRect, 02908 TargetPoint 02909 ); 02910 } 02911 } 02912 else 02913 #endif 02914 ScrollHW(ScreenInfo, 02915 ScrollRect, 02916 MergeRect, 02917 TargetPoint 02918 ); 02919 } 02920 #endif 02921 }

VOID SetActivePalette IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 544 of file server/private.c.

References BOOL, FALSE, NtUserSetInformationThread(), NULL, RealizePalette, and TRUE.

Referenced by ConsoleWindowProc(), DisplayModeTransition(), and SetActiveScreenBuffer().

00547 { 00548 USERTHREAD_USEDESKTOPINFO utudi; 00549 BOOL bReset = FALSE; 00550 00551 if (GetCurrentThreadId() != ScreenInfo->Console->InputThreadInfo->ThreadId) { 00552 bReset = TRUE; 00553 utudi.hThread = ScreenInfo->Console->InputThreadInfo->ThreadHandle; 00554 utudi.drdRestore.pdeskRestore = NULL; 00555 NtUserSetInformationThread(NtCurrentThread(), 00556 UserThreadUseDesktop, 00557 &utudi, sizeof(utudi)); 00558 } 00559 00560 SetSystemPaletteUse(ScreenInfo->Console->hDC, 00561 ScreenInfo->dwUsage 00562 ); 00563 RealizePalette(ScreenInfo->Console->hDC); 00564 00565 if (bReset == TRUE) { 00566 utudi.hThread = NULL; 00567 NtUserSetInformationThread(NtCurrentThread(), 00568 UserThreadUseDesktop, &utudi, sizeof(utudi)); 00569 } 00570 }

NTSTATUS SetActiveScreenBuffer IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 4072 of file output.c.

References BOOL, _SCREEN_INFORMATION::BufferInfo, CONSOLE_IS_ICONIC, CONSOLE_TEXTMODE_BUFFER, CONSOLE_VDM_REGISTERED, _CONSOLE_INFORMATION::CurrentScreenBuffer, FALSE, _CONSOLE_INFORMATION::Flags, _SCREEN_INFORMATION::Flags, FlushAllButKeys(), _CONSOLE_INFORMATION::FullScreenFlags, _CONSOLE_INFORMATION::hDC, _SCREEN_INFORMATION::hPalette, _CONSOLE_INFORMATION::hSysPalette, _CONSOLE_INFORMATION::InputBuffer, _CONSOLE_INFORMATION::InputThreadInfo, NtUserSetInformationThread(), NULL, SelectPalette, SetActivePalette(), SetFont(), SetScreenColors(), SetWindowSize(), TEXT_VALID_HINT, _INPUT_THREAD_INFO::ThreadHandle, _INPUT_THREAD_INFO::ThreadId, TRUE, and WriteToScreen.

Referenced by CloseOutputHandle(), and SrvSetConsoleActiveScreenBuffer().

04075 { 04076 PSCREEN_INFORMATION OldScreenInfo; 04077 PCONSOLE_INFORMATION Console = ScreenInfo->Console; 04078 04079 OldScreenInfo = Console->CurrentScreenBuffer; 04080 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 04081 04082 #if !defined(_X86_) 04083 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 04084 return STATUS_INVALID_PARAMETER; 04085 } 04086 #endif 04087 Console->CurrentScreenBuffer = ScreenInfo; 04088 04089 if (Console->FullScreenFlags == 0) { 04090 04091 // 04092 // initialize cursor 04093 // 04094 04095 ScreenInfo->BufferInfo.TextInfo.CursorOn = FALSE; 04096 04097 // 04098 // set font 04099 // 04100 04101 SetFont(ScreenInfo); 04102 } 04103 #if defined(_X86_) 04104 else if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 04105 04106 if (!(Console->Flags & CONSOLE_VDM_REGISTERED)) { 04107 04108 if ( (!(OldScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER)) || 04109 (OldScreenInfo->BufferInfo.TextInfo.ModeIndex!=ScreenInfo->BufferInfo.TextInfo.ModeIndex)) { 04110 04111 // set video mode and font 04112 SetVideoMode(ScreenInfo); 04113 } 04114 04115 //set up cursor 04116 04117 SetCursorInformationHW(ScreenInfo, 04118 ScreenInfo->BufferInfo.TextInfo.CursorSize, 04119 ScreenInfo->BufferInfo.TextInfo.CursorVisible); 04120 SetCursorPositionHW(ScreenInfo, 04121 ScreenInfo->BufferInfo.TextInfo.CursorPosition); 04122 } 04123 04124 } 04125 #endif 04126 } 04127 else { 04128 Console->CurrentScreenBuffer = ScreenInfo; 04129 } 04130 04131 // 04132 // empty input buffer 04133 // 04134 04135 FlushAllButKeys(&Console->InputBuffer); 04136 04137 if (Console->FullScreenFlags == 0) { 04138 04139 SetScreenColors(ScreenInfo, ScreenInfo->Attributes, 04140 ScreenInfo->PopupAttributes, FALSE); 04141 04142 // 04143 // set window size 04144 // 04145 04146 SetWindowSize(ScreenInfo); 04147 04148 // 04149 // initialize the palette, if we have the focus and we're not fullscreen 04150 // 04151 04152 if (!(Console->Flags & CONSOLE_IS_ICONIC) && 04153 Console->FullScreenFlags == 0) { 04154 if (ScreenInfo->hPalette != NULL || OldScreenInfo->hPalette != NULL) { 04155 HPALETTE hPalette; 04156 BOOL bReset = FALSE; 04157 USERTHREAD_USEDESKTOPINFO utudi; 04158 04159 if (GetCurrentThreadId() != Console->InputThreadInfo->ThreadId) { 04160 bReset = TRUE; 04161 utudi.hThread = Console->InputThreadInfo->ThreadHandle; 04162 utudi.drdRestore.pdeskRestore = NULL; 04163 NtUserSetInformationThread(NtCurrentThread(), 04164 UserThreadUseDesktop, 04165 &utudi, sizeof(utudi)); 04166 } 04167 04168 if (ScreenInfo->hPalette == NULL) { 04169 hPalette = Console->hSysPalette; 04170 } else { 04171 hPalette = ScreenInfo->hPalette; 04172 } 04173 SelectPalette(Console->hDC, 04174 hPalette, 04175 FALSE); 04176 SetActivePalette(ScreenInfo); 04177 04178 if (bReset == TRUE) { 04179 utudi.hThread = NULL; 04180 NtUserSetInformationThread(NtCurrentThread(), 04181 UserThreadUseDesktop, &utudi, sizeof(utudi)); 04182 } 04183 } 04184 } 04185 } 04186 04187 #if defined(FE_IME) 04188 SetUndetermineAttribute(Console); 04189 #endif 04190 // 04191 // write data to screen 04192 // 04193 04194 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 04195 WriteToScreen(ScreenInfo,&ScreenInfo->Window); 04196 return STATUS_SUCCESS; 04197 }

BOOL SetConsoleReserveKeys HWND  hWnd,
DWORD  fsReserveKeys
 

Referenced by ConsoleWindowProc(), DisplayModeTransition(), and SrvSetConsoleKeyShortcuts().

NTSTATUS SetCursorInformation PSCREEN_INFORMATION  ScreenInfo,
ULONG  Size,
BOOLEAN  Visible
 

NTSTATUS SetCursorMode PSCREEN_INFORMATION  ScreenInfo,
BOOLEAN  DoubleCursor
 

NTSTATUS SetCursorPosition IN OUT PSCREEN_INFORMATION  ScreenInfo,
IN COORD  Position,
IN BOOL  TurnOn
 

Definition at line 474 of file ntcon/server/cursor.c.

References CONSOLE_HAS_FOCUS, CONSOLE_VDM_REGISTERED, ConsoleHideCursor(), ConsoleShowCursor(), CursorTimerRoutine(), FALSE, and TRUE.

Referenced by CancelKeySelection(), CommandNumberPopup(), DeleteCommandLine(), InitSelection(), ProcessCommandLine(), ProcessCopyFromCharInput(), ResizeScreenBuffer(), SrvSetConsoleCursorPosition(), and WWSB_AdjustCursorPosition().

00482 : 00483 00484 This routine sets the cursor position in the data structures and on 00485 the screen. 00486 00487 Arguments: 00488 00489 ScreenInfo - pointer to screen info structure. 00490 00491 Position - new position of cursor 00492 00493 TurnOn - true if cursor should be left on, false if should be left off 00494 00495 Return Value: 00496 00497 Status 00498 00499 --*/ 00500 00501 { 00502 // 00503 // don't let cursorposition be set beyond edge of screen buffer 00504 // 00505 00506 if (Position.X >= ScreenInfo->ScreenBufferSize.X || 00507 Position.Y >= ScreenInfo->ScreenBufferSize.Y) { 00508 return STATUS_INVALID_PARAMETER; 00509 } 00510 ConsoleHideCursor(ScreenInfo); 00511 ScreenInfo->BufferInfo.TextInfo.CursorPosition = Position; 00512 #ifdef i386 00513 if ((!(ScreenInfo->Console->Flags & CONSOLE_VDM_REGISTERED)) && 00514 ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 00515 SetCursorPositionHW(ScreenInfo,Position); 00516 } 00517 #endif 00518 ConsoleShowCursor(ScreenInfo); 00519 00520 // if we have the focus, adjust the cursor state 00521 00522 if (ScreenInfo->Console->Flags & CONSOLE_HAS_FOCUS) { 00523 00524 if (TurnOn) { 00525 ScreenInfo->BufferInfo.TextInfo.DelayCursor = FALSE; 00526 CursorTimerRoutine(ScreenInfo); 00527 } else { 00528 ScreenInfo->BufferInfo.TextInfo.DelayCursor = TRUE; 00529 } 00530 ScreenInfo->BufferInfo.TextInfo.CursorMoved = TRUE; 00531 } 00532 00533 return STATUS_SUCCESS; 00534 }

NTSTATUS SetFont IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

NTSTATUS SetInputBufferSize IN PINPUT_INFORMATION  InputInformation,
IN ULONG  Size
 

Definition at line 516 of file ntcon/server/input.c.

References ASSERT, BOOL, BUFFER_TAG, BufferSize, ConsoleHeapAlloc, ConsoleHeapFree, FALSE, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, ReadBuffer(), Size, Status, and TRUE.

Referenced by WriteBuffer().

00523 : 00524 00525 This routine resizes the input buffer. 00526 00527 Arguments: 00528 00529 InputInformation - Pointer to input buffer information structure. 00530 00531 Size - New size in number of events. 00532 00533 Return Value: 00534 00535 Note: 00536 00537 The console lock must be held when calling this routine. 00538 00539 --*/ 00540 00541 { 00542 ULONG NumberOfEventsRead; 00543 NTSTATUS Status; 00544 PINPUT_RECORD InputBuffer; 00545 ULONG BufferSize; 00546 BOOL Dummy; 00547 00548 #if DBG 00549 ULONG_PTR NumberOfEvents; 00550 if (InputInformation->In < InputInformation->Out) { 00551 NumberOfEvents = InputInformation->Last - InputInformation->Out; 00552 NumberOfEvents += InputInformation->In - InputInformation->First; 00553 } 00554 else { 00555 NumberOfEvents = InputInformation->In - InputInformation->Out; 00556 } 00557 NumberOfEvents /= sizeof(INPUT_RECORD); 00558 #endif 00559 ASSERT( Size > InputInformation->InputBufferSize ); 00560 00561 // 00562 // allocate memory for new input buffer 00563 // 00564 00565 BufferSize = sizeof(INPUT_RECORD) * (Size+1); 00566 InputBuffer = (PINPUT_RECORD)ConsoleHeapAlloc(MAKE_TAG( BUFFER_TAG ),BufferSize); 00567 if (InputBuffer == NULL) { 00568 return STATUS_NO_MEMORY; 00569 } 00570 00571 // 00572 // copy old input buffer. 00573 // let the ReadBuffer do any compaction work. 00574 // 00575 00576 Status = ReadBuffer(InputInformation, 00577 InputBuffer, 00578 Size, 00579 &NumberOfEventsRead, 00580 TRUE, 00581 FALSE, 00582 &Dummy 00583 #if defined(FE_SB) 00584 , 00585 TRUE 00586 #endif 00587 ); 00588 00589 if (!NT_SUCCESS(Status)) { 00590 ConsoleHeapFree(InputBuffer); 00591 return Status; 00592 } 00593 InputInformation->Out = (ULONG_PTR)InputBuffer; 00594 InputInformation->In = (ULONG_PTR)InputBuffer + sizeof(INPUT_RECORD) * NumberOfEventsRead; 00595 00596 // 00597 // adjust pointers 00598 // 00599 00600 InputInformation->First = (ULONG_PTR) InputBuffer; 00601 InputInformation->Last = (ULONG_PTR) InputBuffer + BufferSize; 00602 00603 // 00604 // free old input buffer 00605 // 00606 00607 ConsoleHeapFree(InputInformation->InputBuffer); 00608 InputInformation->InputBufferSize = Size; 00609 InputInformation->AllocatedBufferSize = BufferSize; 00610 InputInformation->InputBuffer = InputBuffer; 00611 return Status; 00612 }

VOID SetProcessFocus IN PCSR_PROCESS  Process,
IN BOOL  Foreground
 

Definition at line 4200 of file output.c.

Referenced by AddProcessToList(), and ModifyConsoleProcessFocus().

04204 { 04205 if (Foreground) { 04206 CsrSetForegroundPriority(Process); 04207 } else { 04208 CsrSetBackgroundPriority(Process); 04209 } 04210 }

VOID SetProcessForegroundRights IN PCSR_PROCESS  Process,
IN BOOL  Foreground
 

Definition at line 4213 of file output.c.

References NtUserSetInformationProcess(), W32PF_ALLOWSETFOREGROUND, and W32PF_CONSOLEHASFOCUS.

Referenced by ConsoleClientConnectRoutine(), ModifyConsoleProcessFocus(), and SrvAllocConsole().

04217 { 04218 USERTHREAD_FLAGS Flags; 04219 04220 Flags.dwMask = (W32PF_ALLOWSETFOREGROUND | W32PF_CONSOLEHASFOCUS); 04221 Flags.dwFlags = (Foreground ? (W32PF_ALLOWSETFOREGROUND | W32PF_CONSOLEHASFOCUS) : 0); 04222 04223 NtUserSetInformationProcess(Process->ProcessHandle, UserProcessFlags, &Flags, sizeof(Flags)); 04224 }

NTSTATUS SetScreenBufferFont IN PSCREEN_INFORMATION  ScreenInfo,
IN ULONG  FontIndex
 

NTSTATUS SetScreenColors IN PSCREEN_INFORMATION  ScreenInfo,
IN WORD  Attributes,
IN WORD  PopupAttributes,
IN BOOL  UpdateWholeScreen
 

Definition at line 1002 of file ntcon/server/getset.c.

References ACTIVE_SCREEN_BUFFER, _ATTR_PAIR::Attr, _ROW::AttrRow, _ATTR_ROW::Attrs, CONSOLE_TEXTMODE_BUFFER, ConvertAttrToRGB, _CONSOLE_INFORMATION::hDC, _CONSOLE_INFORMATION::hWnd, _CONSOLE_INFORMATION::LastAttributes, _ATTR_ROW::Length, LOBYTE, _CONSOLE_INFORMATION::PopupCount, SetConsoleBkColor, SHORT, TEXT_VALID_HINT, UpdatePopups(), and WriteToScreen.

Referenced by ConsoleWindowProc(), CreateWindowsWindow(), PropertiesUpdate(), SetActiveScreenBuffer(), and SrvSetConsoleTextAttribute().

01008 { 01009 SHORT i,j; 01010 PROW Row; 01011 WORD DefaultAttributes,DefaultPopupAttributes; 01012 PCONSOLE_INFORMATION Console; 01013 COLORREF rgbBk; 01014 COLORREF rgbText; 01015 01016 Console = ScreenInfo->Console; 01017 rgbBk = ConvertAttrToRGB(Console, LOBYTE(Attributes >> 4)); 01018 rgbBk = GetNearestColor(Console->hDC, rgbBk); 01019 rgbText = ConvertAttrToRGB(Console, LOBYTE(Attributes)); 01020 rgbText = GetNearestColor(Console->hDC, rgbText); 01021 if (ACTIVE_SCREEN_BUFFER(ScreenInfo)) { 01022 SetDCBrushColor(Console->hDC, rgbBk); 01023 SetTextColor(Console->hDC, rgbText); 01024 SetBkColor(Console->hDC, rgbBk); 01025 Console->LastAttributes = Attributes; 01026 SetConsoleBkColor(Console->hWnd, rgbBk); 01027 } 01028 01029 DefaultAttributes = ScreenInfo->Attributes; 01030 DefaultPopupAttributes = ScreenInfo->PopupAttributes; 01031 ScreenInfo->Attributes = Attributes; 01032 ScreenInfo->PopupAttributes = PopupAttributes; 01033 #if defined(FE_IME) 01034 SetUndetermineAttribute( Console ); 01035 #endif 01036 01037 if (UpdateWholeScreen && ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 01038 WORD InvertedOldPopupAttributes,InvertedNewPopupAttributes; 01039 01040 InvertedOldPopupAttributes = (WORD)(((DefaultPopupAttributes << 4) & 0xf0) | 01041 ((DefaultPopupAttributes >> 4) & 0x0f)); 01042 InvertedNewPopupAttributes = (WORD)(((PopupAttributes << 4) & 0xf0) | 01043 ((PopupAttributes >> 4) & 0x0f)); 01044 // 01045 // change all chars with default color 01046 // 01047 01048 for (i=0;i<ScreenInfo->ScreenBufferSize.Y;i++) { 01049 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[i]; 01050 for (j=0;j<Row->AttrRow.Length;j++) { 01051 if (Row->AttrRow.Attrs[j].Attr == DefaultAttributes) { 01052 Row->AttrRow.Attrs[j].Attr = Attributes; 01053 } else if (Row->AttrRow.Attrs[j].Attr == DefaultPopupAttributes) { 01054 Row->AttrRow.Attrs[j].Attr = PopupAttributes; 01055 } else if (Row->AttrRow.Attrs[j].Attr == InvertedOldPopupAttributes) { 01056 Row->AttrRow.Attrs[j].Attr = InvertedNewPopupAttributes; 01057 } 01058 } 01059 } 01060 01061 if (Console->PopupCount) 01062 UpdatePopups(Console, 01063 Attributes, 01064 PopupAttributes, 01065 DefaultAttributes, 01066 DefaultPopupAttributes 01067 ); 01068 // force repaint of entire line 01069 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 01070 WriteToScreen(ScreenInfo,&ScreenInfo->Window); 01071 ScreenInfo->BufferInfo.TextInfo.Flags |= TEXT_VALID_HINT; 01072 } 01073 01074 return STATUS_SUCCESS; 01075 }

NTSTATUS SetWindowOrigin IN PSCREEN_INFORMATION  ScreenInfo,
IN BOOLEAN  Absolute,
IN OUT COORD  WindowOrigin
 

VOID SetWindowSize IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 3953 of file output.c.

References CM_SET_WINDOW_SIZE, CONSOLE_SETTING_WINDOW_SIZE, NULL, and PostMessage().

Referenced by ConvertToFullScreen(), ConvertToWindowed(), ResizeScreenBuffer(), SetActiveScreenBuffer(), SetScreenBufferFont(), and SrvSetConsoleWindowInfo().

03956 { 03957 #if defined(FE_IME) 03958 if (ScreenInfo->ConvScreenInfo != NULL) 03959 return; 03960 #endif 03961 if (ScreenInfo->Console->Flags & CONSOLE_SETTING_WINDOW_SIZE) 03962 return; 03963 ScreenInfo->Console->Flags |= CONSOLE_SETTING_WINDOW_SIZE; 03964 PostMessage(ScreenInfo->Console->hWnd, 03965 CM_SET_WINDOW_SIZE, 03966 (WPARAM)ScreenInfo, 03967 0x47474747 03968 ); 03969 }

VOID SetWinText IN PCONSOLE_INFORMATION  Console,
IN UINT  wID,
IN BOOL  Add
 

Definition at line 236 of file ntcon/server/menu.c.

References GetWindowText(), ghInstance, and SetWindowText().

Referenced by CancelKeySelection(), CancelMouseSelection(), ClearScroll(), ConvertToMouseSelect(), DoScroll(), DoSelectAll(), FindDialogProc(), HandleMouseEvent(), and InitSelection().

00250 { 00251 WCHAR TextBuf[256]; 00252 PWCHAR TextBufPtr; 00253 int TextLength; 00254 int NameLength; 00255 WCHAR NameString[20]; 00256 00257 NameLength = LoadString(ghInstance,wID,NameString, 00258 sizeof(NameString)/sizeof(WCHAR)); 00259 if (Add) { 00260 RtlCopyMemory(TextBuf,NameString,NameLength*sizeof(WCHAR)); 00261 TextBuf[NameLength] = ' '; 00262 TextBufPtr = TextBuf + NameLength + 1; 00263 } else { 00264 TextBufPtr = TextBuf; 00265 } 00266 TextLength = GetWindowText(Console->hWnd, 00267 TextBufPtr, 00268 sizeof(TextBuf)/sizeof(WCHAR)-NameLength-1); 00269 if (TextLength == 0) 00270 return; 00271 if (Add) { 00272 TextBufPtr = TextBuf; 00273 } else { 00274 /* 00275 * The window title might have already been reset, so make sure 00276 * the name is there before trying to remove it. 00277 */ 00278 if (wcsncmp(NameString, TextBufPtr, NameLength) != 0) 00279 return; 00280 TextBufPtr = TextBuf + NameLength + 1; 00281 } 00282 SetWindowText(Console->hWnd,TextBufPtr); 00283 }

ULONG ShutdownConsole IN HANDLE  ConsoleHandle,
IN DWORD  dwFlags
 

Referenced by ConsoleClientShutdown(), and UnlockConsole().

VOID ShutdownSubst VOID   ) 
 

ULONG SrvAddConsoleAlias IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 608 of file server/cmdline.c.

References AddAlias(), AddExeAliasList(), ApiPreamble(), BYTE, _CONSOLE_ADDALIAS_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, ConvertInputToUnicode(), _CONSOLE_INFORMATION::CP, _CONSOLE_ADDALIAS_MSG::Exe, _CONSOLE_ADDALIAS_MSG::ExeLength, FindAlias(), FindExe(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, RemoveAlias(), ReplaceAlias(), _CONSOLE_ADDALIAS_MSG::Source, _CONSOLE_ADDALIAS_MSG::SourceLength, Status, _CONSOLE_ADDALIAS_MSG::Target, _CONSOLE_ADDALIAS_MSG::TargetLength, TMP_TAG, _CONSOLE_ADDALIAS_MSG::Unicode, _CONSOLE_ADDALIAS_MSG::UnicodeExe, UnlockConsole(), and USHORT.

00615 : 00616 00617 This routine adds a command line alias to the global set. 00618 00619 Arguments: 00620 00621 m - message containing api parameters 00622 00623 ReplyStatus - Indicates whether to reply to the dll port. 00624 00625 Return Value: 00626 00627 --*/ 00628 00629 { 00630 00631 PCONSOLE_ADDALIAS_MSG a = (PCONSOLE_ADDALIAS_MSG)&m->u.ApiMessageData; 00632 PALIAS Alias; 00633 PCONSOLE_INFORMATION Console; 00634 PEXE_ALIAS_LIST ExeAliasList; 00635 NTSTATUS Status; 00636 LPWSTR Source,Target; 00637 00638 Status = ApiPreamble(a->ConsoleHandle, 00639 &Console 00640 ); 00641 if (!NT_SUCCESS(Status)) { 00642 return Status; 00643 } 00644 00645 if (!CsrValidateMessageBuffer(m, &a->Source, a->SourceLength, sizeof(BYTE)) || 00646 !CsrValidateMessageBuffer(m, &a->Target,a->TargetLength, sizeof(BYTE)) || 00647 !CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 00648 00649 UnlockConsole(Console); 00650 return STATUS_INVALID_PARAMETER; 00651 } 00652 00653 if (a->Unicode) { 00654 Source = a->Source; 00655 Target = a->Target; 00656 } else { 00657 Source = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),a->SourceLength*sizeof(WCHAR)); 00658 if (Source == NULL) { 00659 UnlockConsole(Console); 00660 return (ULONG)STATUS_NO_MEMORY; 00661 } 00662 Target = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),a->TargetLength*sizeof(WCHAR)); 00663 if (Target == NULL) { 00664 ConsoleHeapFree(Source); 00665 UnlockConsole(Console); 00666 return (ULONG)STATUS_NO_MEMORY; 00667 } 00668 a->SourceLength = (USHORT)ConvertInputToUnicode(Console->CP, 00669 a->Source, 00670 a->SourceLength, 00671 Source, 00672 a->SourceLength); 00673 a->SourceLength *= 2; 00674 a->TargetLength = (USHORT)ConvertInputToUnicode(Console->CP, 00675 a->Target, 00676 a->TargetLength, 00677 Target, 00678 a->TargetLength); 00679 a->TargetLength *= 2; 00680 } 00681 00682 // 00683 // find specified exe. if it's not there, add it if we're not 00684 // removing an alias. 00685 // 00686 00687 ExeAliasList = FindExe(Console,a->Exe,a->ExeLength,a->UnicodeExe); 00688 if (ExeAliasList) { 00689 Alias = FindAlias(ExeAliasList,Source,a->SourceLength); 00690 if (a->TargetLength) { 00691 if (Alias) { 00692 Status = ReplaceAlias(Alias, 00693 Target, 00694 a->TargetLength); 00695 } else { 00696 Status = AddAlias(ExeAliasList, 00697 Source, 00698 a->SourceLength, 00699 Target, 00700 a->TargetLength); 00701 } 00702 } else { 00703 if (Alias) { 00704 Status = RemoveAlias(Alias); 00705 } 00706 } 00707 } else { 00708 if (a->TargetLength) { 00709 ExeAliasList = AddExeAliasList(Console,a->Exe,a->ExeLength,a->UnicodeExe); 00710 if (ExeAliasList) { 00711 Status = AddAlias(ExeAliasList, 00712 Source, 00713 a->SourceLength, 00714 Target, 00715 a->TargetLength); 00716 } else { 00717 Status = STATUS_NO_MEMORY; 00718 } 00719 } 00720 } 00721 UnlockConsole(Console); 00722 if (!a->Unicode) { 00723 ConsoleHeapFree(Source); 00724 ConsoleHeapFree(Target); 00725 } 00726 return Status; 00727 UNREFERENCED_PARAMETER(ReplyStatus); 00728 }

ULONG SrvAllocConsole IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1537 of file srvinit.c.

References AddProcessToList(), AllocateCommandHistory(), _CONSOLE_ALLOC_MSG::AppName, _CONSOLE_ALLOC_MSG::AppNameLength, ASSERT, BYTE, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_GETCONSOLEAPPFROMPROCESSDATA, CONSOLE_HAS_FOCUS, CONSOLE_PERPROCESSDATA, CONSOLE_SETCONSOLEAPP, CONSOLE_SHUTTING_DOWN, _CONSOLE_INFO::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, _CONSOLE_ALLOC_MSG::ConsoleInfo, _CONSOLE_PROCESS_HANDLE::CtrlRoutine, _CONSOLE_ALLOC_MSG::CtrlRoutine, _CONSOLE_ALLOC_MSG::CurDir, _CONSOLE_ALLOC_MSG::CurDirLength, _CONSOLE_ALLOC_MSG::Desktop, _CONSOLE_ALLOC_MSG::DesktopLength, _CONSOLE_INFORMATION::Flags, HANDLE_TAG, L, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, PCONSOLE_ALLOC_MSG, _CONSOLE_PROCESS_HANDLE::Process, _CONSOLE_PROCESS_HANDLE::PropRoutine, _CONSOLE_ALLOC_MSG::PropRoutine, RevalidateConsole(), RtlInitUnicodeString(), SetProcessForegroundRights(), SetUpConsole(), Status, _CONSOLE_ALLOC_MSG::Title, _CONSOLE_ALLOC_MSG::TitleLength, TRUE, and UnlockConsole().

01541 { 01542 PCONSOLE_ALLOC_MSG a = (PCONSOLE_ALLOC_MSG)&m->u.ApiMessageData; 01543 PCONSOLE_PER_PROCESS_DATA ProcessData; 01544 NTSTATUS Status; 01545 PCONSOLE_INFORMATION Console; 01546 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 01547 PCSR_PROCESS Process; 01548 UNICODE_STRING strDesktopName; 01549 01550 ProcessData = CONSOLE_PERPROCESSDATA(); 01551 ASSERT(!CONSOLE_GETCONSOLEAPPFROMPROCESSDATA(ProcessData)); 01552 01553 if (!CsrValidateMessageBuffer(m, &a->Title, a->TitleLength, sizeof(BYTE)) || 01554 !CsrValidateMessageBuffer(m, &a->Desktop, a->DesktopLength, sizeof(BYTE)) || 01555 !CsrValidateMessageBuffer(m, &a->CurDir, a->CurDirLength, sizeof(BYTE)) || 01556 !CsrValidateMessageBuffer(m, &a->AppName, a->AppNameLength, sizeof(BYTE)) || 01557 !CsrValidateMessageBuffer(m, &a->ConsoleInfo, sizeof(*a->ConsoleInfo), sizeof(BYTE))) { 01558 01559 return STATUS_INVALID_PARAMETER; 01560 } 01561 01562 Process = (PCSR_PROCESS)(CSR_SERVER_QUERYCLIENTTHREAD()->Process); 01563 if (a->DesktopLength) 01564 RtlInitUnicodeString(&strDesktopName, a->Desktop); 01565 else 01566 RtlInitUnicodeString(&strDesktopName, L"Default"); 01567 01568 ProcessHandleRecord = ConsoleHeapAlloc(MAKE_TAG( HANDLE_TAG ),sizeof(CONSOLE_PROCESS_HANDLE)); 01569 if (ProcessHandleRecord == NULL) { 01570 return (ULONG)STATUS_NO_MEMORY; 01571 } 01572 01573 Status = SetUpConsole(a->ConsoleInfo, 01574 a->TitleLength, 01575 a->Title, 01576 a->CurDir, 01577 a->AppName, 01578 ProcessData, 01579 TRUE, 01580 &strDesktopName); 01581 if (!NT_SUCCESS(Status)) { 01582 ConsoleHeapFree(ProcessHandleRecord); 01583 return Status; 01584 } 01585 CONSOLE_SETCONSOLEAPP(TRUE); 01586 Process->Flags |= CSR_PROCESS_CONSOLEAPP; 01587 Status = RevalidateConsole(a->ConsoleInfo->ConsoleHandle,&Console); 01588 ASSERT (NT_SUCCESS(Status)); 01589 ProcessHandleRecord->Process = CSR_SERVER_QUERYCLIENTTHREAD()->Process; 01590 ProcessHandleRecord->CtrlRoutine = a->CtrlRoutine; 01591 ProcessHandleRecord->PropRoutine = a->PropRoutine; 01592 ASSERT (!(Console->Flags & CONSOLE_SHUTTING_DOWN)); 01593 AddProcessToList(Console,ProcessHandleRecord,CONSOLE_CLIENTPROCESSHANDLE()); 01594 SetProcessForegroundRights(Process, 01595 Console->Flags & CONSOLE_HAS_FOCUS); 01596 (HANDLE) AllocateCommandHistory(Console, 01597 a->AppNameLength, 01598 a->AppName, 01599 CONSOLE_CLIENTPROCESSHANDLE()); 01600 01601 UnlockConsole(Console); 01602 01603 return STATUS_SUCCESS; 01604 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01605 }

ULONG SrvCloseHandle IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2997 of file server/stream.c.

References ApiPreamble(), CloseInputHandle(), CloseOutputHandle(), CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_CLOSEHANDLE_MSG::ConsoleHandle, DereferenceIoHandleNoCheck(), _CONSOLE_CLOSEHANDLE_MSG::Handle, HANDLE_TO_INDEX, _HANDLE_DATA::HandleType, NT_SUCCESS, NTSTATUS(), Status, TRUE, and UnlockConsole().

03004 : 03005 03006 This routine closes an input or output handle. 03007 03008 Arguments: 03009 03010 ApiMessageData - Points to parameter structure. 03011 03012 Return Value: 03013 03014 --*/ 03015 03016 { 03017 PCONSOLE_CLOSEHANDLE_MSG a = (PCONSOLE_CLOSEHANDLE_MSG)&m->u.ApiMessageData; 03018 PCONSOLE_INFORMATION Console; 03019 PHANDLE_DATA HandleData; 03020 NTSTATUS Status; 03021 PCONSOLE_PER_PROCESS_DATA ProcessData; 03022 03023 Status = ApiPreamble(a->ConsoleHandle, 03024 &Console 03025 ); 03026 if (!NT_SUCCESS(Status)) { 03027 return Status; 03028 } 03029 ProcessData = CONSOLE_PERPROCESSDATA(); 03030 Status = DereferenceIoHandleNoCheck(ProcessData, 03031 HANDLE_TO_INDEX(a->Handle), 03032 &HandleData 03033 ); 03034 if (NT_SUCCESS(Status)) { 03035 if (HandleData->HandleType & CONSOLE_INPUT_HANDLE) 03036 Status = CloseInputHandle(ProcessData,Console,HandleData,HANDLE_TO_INDEX(a->Handle)); 03037 else { 03038 Status = CloseOutputHandle(ProcessData,Console,HandleData,HANDLE_TO_INDEX(a->Handle),TRUE); 03039 } 03040 } 03041 UnlockConsole(Console); 03042 return((ULONG) Status); 03043 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 03044 }

ULONG SrvConsoleMenuControl IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 373 of file server/private.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, _CONSOLE_MENUCONTROL_MSG::CommandIdHigh, _CONSOLE_MENUCONTROL_MSG::CommandIdLow, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_MENUCONTROL_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_MENUCONTROL_MSG::hMenu, NT_SUCCESS, NTSTATUS(), _CONSOLE_MENUCONTROL_MSG::OutputHandle, Status, and UnlockConsole().

00380 : 00381 00382 Sets the command id range for the current screen buffer and returns the 00383 menu handle. 00384 00385 Parameters: 00386 00387 hConsoleOutput - Supplies a console output handle. 00388 00389 dwCommandIdLow - Specifies the lowest command id to store in the input buffer. 00390 00391 dwCommandIdHigh - Specifies the highest command id to store in the input 00392 buffer. 00393 00394 Return value: 00395 00396 TRUE - The operation was successful. 00397 00398 FALSE/NULL - The operation failed. Extended error status is available 00399 using GetLastError. 00400 00401 --*/ 00402 00403 { 00404 PCONSOLE_MENUCONTROL_MSG a = (PCONSOLE_MENUCONTROL_MSG)&m->u.ApiMessageData; 00405 NTSTATUS Status; 00406 PCONSOLE_INFORMATION Console; 00407 PHANDLE_DATA HandleData; 00408 00409 Status = ApiPreamble(a->ConsoleHandle, 00410 &Console 00411 ); 00412 if (!NT_SUCCESS(Status)) { 00413 return Status; 00414 } 00415 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00416 a->OutputHandle, 00417 CONSOLE_OUTPUT_HANDLE | CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00418 GENERIC_WRITE, 00419 &HandleData 00420 ); 00421 if (NT_SUCCESS(Status)) { 00422 a->hMenu = HandleData->Buffer.ScreenBuffer->Console->hMenu; 00423 HandleData->Buffer.ScreenBuffer->CommandIdLow = a->CommandIdLow; 00424 HandleData->Buffer.ScreenBuffer->CommandIdHigh = a->CommandIdHigh; 00425 } 00426 UnlockConsole(Console); 00427 return Status; 00428 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00429 }

NTSTATUS SrvConsoleNotifyLastClose IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1346 of file server/private.c.

References ApiPreamble(), ASSERT, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_CLIENTPROCESSID, CONSOLE_NOTIFY_LAST_CLOSE, _CONSOLE_NOTIFYLASTCLOSE_MSG::ConsoleHandle, FALSE, _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::hProcessLastNotifyClose, NT_SUCCESS, NtDuplicateObject(), NTSTATUS(), NULL, PCONSOLE_NOTIFYLASTCLOSE_MSG, _CONSOLE_INFORMATION::ProcessIdLastNotifyClose, Status, UnlockConsole(), _CONSOLE_INFORMATION::VDMProcessHandle, and _CONSOLE_INFORMATION::VDMProcessId.

01350 { 01351 PCONSOLE_NOTIFYLASTCLOSE_MSG a = (PCONSOLE_NOTIFYLASTCLOSE_MSG)&m->u.ApiMessageData; 01352 NTSTATUS Status; 01353 PCONSOLE_INFORMATION Console; 01354 01355 Status = ApiPreamble(a->ConsoleHandle, 01356 &Console 01357 ); 01358 if (!NT_SUCCESS(Status)) { 01359 return Status; 01360 } 01361 // williamh, Feb 2 1994. 01362 // this non-X86 special case is not necessary. We expect 01363 // ntvdm to call RegisterConsoleVDM API and there we do duplicate 01364 // the vdm process handle and grab its process id. 01365 // If we continue to do this we may hit the assert below 01366 // because when RegisterConsoleVDM failed(short of memory, for example) 01367 // the VDMProcessHandle may have been set and next time a vdm application 01368 // was launched from the same console(ntvdm will do the NotifyLastClose 01369 // before RegisterConsoleVDM). 01370 #if 0 01371 #if !defined(_X86_) 01372 ASSERT(Console->VDMProcessHandle == NULL); 01373 Status = NtDuplicateObject(NtCurrentProcess(), CONSOLE_CLIENTPROCESSHANDLE(), 01374 NtCurrentProcess(), &Console->VDMProcessHandle, 01375 0, FALSE, DUPLICATE_SAME_ACCESS); 01376 if (!NT_SUCCESS(Status)) { 01377 return Status; 01378 } 01379 Console->VDMProcessId = CONSOLE_CLIENTPROCESSID(); 01380 #endif 01381 #endif 01382 // Doesn't allow two or more processes to have last-close notify on 01383 // the same console 01384 if (Console->Flags & CONSOLE_NOTIFY_LAST_CLOSE) { 01385 UnlockConsole(Console); 01386 return (ULONG)STATUS_ACCESS_DENIED; 01387 } 01388 01389 Status = NtDuplicateObject(NtCurrentProcess(), CONSOLE_CLIENTPROCESSHANDLE(), 01390 NtCurrentProcess(), 01391 &Console->hProcessLastNotifyClose, 01392 0, FALSE, DUPLICATE_SAME_ACCESS 01393 ); 01394 if (!NT_SUCCESS(Status)) { 01395 UnlockConsole(Console); 01396 return Status; 01397 } 01398 01399 Console->Flags |= CONSOLE_NOTIFY_LAST_CLOSE; 01400 Console->ProcessIdLastNotifyClose = CONSOLE_CLIENTPROCESSID(); 01401 UnlockConsole(Console); 01402 return Status; 01403 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01404 }

ULONG SrvConsoleSubst IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

ULONG SrvCreateConsoleScreenBuffer IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1607 of file directio.c.

References AllocateIoHandle(), ApiPreamble(), ASSERT, _SCREEN_INFORMATION::Attributes, _HANDLE_DATA::Buffer, BYTE, CON_FACENAME, CON_FAMILY, CON_FONTCODEPAGE, CON_FONTSIZE, CON_FONTWEIGHT, CONSOLE_GRAPHICS_BUFFER, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_INHERITABLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, ConsoleAddShare(), _CONSOLE_CREATESCREENBUFFER_MSG::ConsoleHandle, CreateScreenBuffer(), _CONSOLE_INFORMATION::CurrentScreenBuffer, CURSOR_SMALL_SIZE, DBGOUTPUT, DereferenceIoHandleNoCheck(), _CONSOLE_CREATESCREENBUFFER_MSG::DesiredAccess, FindCreateFont(), _CONSOLE_CREATESCREENBUFFER_MSG::Flags, FreeIoHandle(), FreeScreenBuffer(), _CONSOLE_CREATESCREENBUFFER_MSG::GraphicsBufferInfo, Handle, _CONSOLE_CREATESCREENBUFFER_MSG::Handle, _CONSOLE_CREATESCREENBUFFER_MSG::hMutex, INDEX_TO_HANDLE, _CONSOLE_CREATESCREENBUFFER_MSG::InheritHandle, InitializeOutputHandle(), InsertScreenBuffer(), _CONSOLE_CREATESCREENBUFFER_MSG::lpBitmap, NT_SUCCESS, NTSTATUS(), NULL, _SCREEN_INFORMATION::ShareAccess, _CONSOLE_CREATESCREENBUFFER_MSG::ShareMode, SHORT, Status, and UnlockConsole().

01614 : 01615 01616 This routine creates a screen buffer and returns a handle to it. 01617 01618 Arguments: 01619 01620 ApiMessageData - Points to parameter structure. 01621 01622 Return Value: 01623 01624 --*/ 01625 01626 { 01627 PCONSOLE_CREATESCREENBUFFER_MSG a = (PCONSOLE_CREATESCREENBUFFER_MSG)&m->u.ApiMessageData; 01628 NTSTATUS Status; 01629 PCONSOLE_INFORMATION Console; 01630 HANDLE Handle; 01631 PHANDLE_DATA HandleData; 01632 PCONSOLE_SHARE_ACCESS ShareAccess; 01633 CHAR_INFO Fill; 01634 COORD WindowSize; 01635 PSCREEN_INFORMATION ScreenInfo; 01636 PCONSOLE_PER_PROCESS_DATA ProcessData; 01637 ULONG HandleType; 01638 int FontIndex; 01639 01640 DBGOUTPUT(("SrvCreateConsoleScreenBuffer\n")); 01641 Status = ApiPreamble(a->ConsoleHandle, 01642 &Console 01643 ); 01644 if (!NT_SUCCESS(Status)) { 01645 return Status; 01646 } 01647 01648 if (a->Flags & CONSOLE_GRAPHICS_BUFFER) { 01649 if (!CsrValidateMessageBuffer(m, &a->GraphicsBufferInfo.lpBitMapInfo, a->GraphicsBufferInfo.dwBitMapInfoLength, sizeof(BYTE))) { 01650 UnlockConsole(Console); 01651 return STATUS_INVALID_PARAMETER; 01652 } 01653 } 01654 01655 try { 01656 Handle = (HANDLE) -1; 01657 ProcessData = CONSOLE_PERPROCESSDATA(); 01658 HandleType = (a->Flags & CONSOLE_GRAPHICS_BUFFER) ? 01659 CONSOLE_GRAPHICS_OUTPUT_HANDLE : CONSOLE_OUTPUT_HANDLE; 01660 if (a->InheritHandle) 01661 HandleType |= CONSOLE_INHERITABLE; 01662 Status = AllocateIoHandle(ProcessData, 01663 HandleType, 01664 &Handle 01665 ); 01666 if (!NT_SUCCESS(Status)) { 01667 leave; 01668 } 01669 Status = DereferenceIoHandleNoCheck(ProcessData, 01670 Handle, 01671 &HandleData 01672 ); 01673 ASSERT (NT_SUCCESS(Status)); 01674 if (!NT_SUCCESS(Status)) { 01675 leave; 01676 } 01677 01678 // 01679 // create new screen buffer 01680 // 01681 01682 Fill.Char.UnicodeChar = (WCHAR)' '; 01683 Fill.Attributes = Console->CurrentScreenBuffer->Attributes; 01684 WindowSize.X = (SHORT)CONSOLE_WINDOW_SIZE_X(Console->CurrentScreenBuffer); 01685 WindowSize.Y = (SHORT)CONSOLE_WINDOW_SIZE_Y(Console->CurrentScreenBuffer); 01686 FontIndex = FindCreateFont(CON_FAMILY(Console), 01687 CON_FACENAME(Console), 01688 CON_FONTSIZE(Console), 01689 CON_FONTWEIGHT(Console), 01690 CON_FONTCODEPAGE(Console) 01691 ); 01692 Status = CreateScreenBuffer(&ScreenInfo,WindowSize, 01693 FontIndex, 01694 WindowSize, 01695 Fill,Fill,Console, 01696 a->Flags,&a->GraphicsBufferInfo, 01697 &a->lpBitmap,&a->hMutex, 01698 CURSOR_SMALL_SIZE, 01699 NULL); 01700 if (!NT_SUCCESS(Status)) { 01701 leave; 01702 } 01703 InitializeOutputHandle(HandleData,ScreenInfo); 01704 ShareAccess = &ScreenInfo->ShareAccess; 01705 01706 Status = ConsoleAddShare(a->DesiredAccess, 01707 a->ShareMode, 01708 ShareAccess, 01709 HandleData 01710 ); 01711 if (!NT_SUCCESS(Status)) { 01712 HandleData->Buffer.ScreenBuffer->RefCount--; 01713 FreeScreenBuffer(ScreenInfo); 01714 leave; 01715 } 01716 InsertScreenBuffer(Console, ScreenInfo); 01717 a->Handle = INDEX_TO_HANDLE(Handle); 01718 } finally { 01719 if (!NT_SUCCESS(Status) && Handle != (HANDLE)-1) { 01720 FreeIoHandle(ProcessData, 01721 Handle 01722 ); 01723 } 01724 UnlockConsole(Console); 01725 } 01726 return Status; 01727 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01728 } }

ULONG SrvDuplicateHandle IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2603 of file server/stream.c.

References _HANDLE_DATA::Access, AllocateIoHandle(), ApiPreamble(), ASSERT, _HANDLE_DATA::Buffer, CloseInputHandle(), CloseOutputHandle(), CONSOLE_INHERITABLE, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, ConsoleDupShare(), _CONSOLE_DUPHANDLE_MSG::ConsoleHandle, DereferenceIoHandleNoCheck(), _CONSOLE_DUPHANDLE_MSG::DesiredAccess, exit, FreeIoHandle(), HANDLE_TO_INDEX, _HANDLE_DATA::HandleType, INDEX_TO_HANDLE, _CONSOLE_DUPHANDLE_MSG::InheritHandle, InitializeInputHandle(), InitializeOutputHandle(), NT_SUCCESS, NTSTATUS(), _CONSOLE_DUPHANDLE_MSG::Options, _HANDLE_DATA::ShareAccess, _CONSOLE_DUPHANDLE_MSG::SourceHandle, Status, _CONSOLE_DUPHANDLE_MSG::TargetHandle, TRUE, and UnlockConsole().

02610 : 02611 02612 This routine duplicates an input or output handle. 02613 02614 Arguments: 02615 02616 ApiMessageData - Points to parameter structure. 02617 02618 Return Value: 02619 02620 --*/ 02621 02622 { 02623 PCONSOLE_DUPHANDLE_MSG a = (PCONSOLE_DUPHANDLE_MSG)&m->u.ApiMessageData; 02624 PCONSOLE_INFORMATION Console; 02625 PHANDLE_DATA SourceHandleData,TargetHandleData; 02626 PCONSOLE_SHARE_ACCESS ShareAccess; 02627 NTSTATUS Status; 02628 PCONSOLE_PER_PROCESS_DATA ProcessData; 02629 02630 Status = ApiPreamble(a->ConsoleHandle, 02631 &Console 02632 ); 02633 if (!NT_SUCCESS(Status)) { 02634 return Status; 02635 } 02636 ProcessData = CONSOLE_PERPROCESSDATA(); 02637 Status = DereferenceIoHandleNoCheck(ProcessData, 02638 HANDLE_TO_INDEX(a->SourceHandle), 02639 &SourceHandleData 02640 ); 02641 if (!NT_SUCCESS(Status)) { 02642 goto exit; 02643 } 02644 if (a->Options & DUPLICATE_SAME_ACCESS) { 02645 a->DesiredAccess = SourceHandleData->Access; 02646 } 02647 02648 // 02649 // make sure that requested access is a subset of source handle's access 02650 // 02651 02652 else if ((a->DesiredAccess & SourceHandleData->Access) != a->DesiredAccess) { 02653 Status = STATUS_INVALID_PARAMETER; 02654 goto exit; 02655 } 02656 Status = AllocateIoHandle(ProcessData, 02657 SourceHandleData->HandleType, 02658 &a->TargetHandle 02659 ); 02660 if (!NT_SUCCESS(Status)) { 02661 goto exit; 02662 } 02663 02664 // 02665 // it's possible that AllocateIoHandle realloced the handle table, 02666 // so deference SourceHandle again. 02667 // 02668 02669 Status = DereferenceIoHandleNoCheck(ProcessData, 02670 HANDLE_TO_INDEX(a->SourceHandle), 02671 &SourceHandleData 02672 ); 02673 ASSERT (NT_SUCCESS(Status)); 02674 if (!NT_SUCCESS(Status)) { 02675 goto exit; 02676 } 02677 Status = DereferenceIoHandleNoCheck(ProcessData, 02678 a->TargetHandle, 02679 &TargetHandleData 02680 ); 02681 ASSERT (NT_SUCCESS(Status)); 02682 if (!NT_SUCCESS(Status)) { 02683 FreeIoHandle(ProcessData, 02684 a->TargetHandle 02685 ); 02686 goto exit; 02687 } 02688 if (SourceHandleData->HandleType & CONSOLE_INPUT_HANDLE) { 02689 // grab input lock 02690 if (!InitializeInputHandle(TargetHandleData, 02691 SourceHandleData->Buffer.InputBuffer)) { 02692 FreeIoHandle(ProcessData, 02693 a->TargetHandle 02694 ); 02695 Status = STATUS_NO_MEMORY; 02696 goto exit; 02697 } 02698 ShareAccess = &SourceHandleData->Buffer.InputBuffer->ShareAccess; 02699 } 02700 else { 02701 // grab output lock 02702 InitializeOutputHandle(TargetHandleData,SourceHandleData->Buffer.ScreenBuffer); 02703 ShareAccess = &SourceHandleData->Buffer.ScreenBuffer->ShareAccess; 02704 } 02705 TargetHandleData->HandleType = SourceHandleData->HandleType; 02706 if (a->InheritHandle) { 02707 TargetHandleData->HandleType |= CONSOLE_INHERITABLE; 02708 } else { 02709 TargetHandleData->HandleType &= ~CONSOLE_INHERITABLE; 02710 } 02711 02712 Status = ConsoleDupShare(a->DesiredAccess, 02713 SourceHandleData->ShareAccess, 02714 ShareAccess, 02715 TargetHandleData 02716 ); 02717 if (!NT_SUCCESS(Status)) { 02718 FreeIoHandle(ProcessData, 02719 a->TargetHandle 02720 ); 02721 if (SourceHandleData->HandleType & CONSOLE_INPUT_HANDLE) { 02722 SourceHandleData->Buffer.InputBuffer->RefCount--; 02723 } 02724 else { 02725 SourceHandleData->Buffer.ScreenBuffer->RefCount--; 02726 } 02727 } 02728 else { 02729 a->TargetHandle = INDEX_TO_HANDLE(a->TargetHandle); 02730 } 02731 02732 if (a->Options & DUPLICATE_CLOSE_SOURCE) { 02733 if (SourceHandleData->HandleType & CONSOLE_INPUT_HANDLE) 02734 CloseInputHandle(ProcessData,Console,SourceHandleData,HANDLE_TO_INDEX(a->SourceHandle)); 02735 else { 02736 CloseOutputHandle(ProcessData,Console,SourceHandleData,HANDLE_TO_INDEX(a->SourceHandle),TRUE); 02737 } 02738 } 02739 02740 exit: 02741 UnlockConsole(Console); 02742 return Status; 02743 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02744 }

DWORD SrvExpungeConsoleCommandHistory IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1393 of file server/cmdline.c.

References ApiPreamble(), BYTE, _CONSOLE_EXPUNGECOMMANDHISTORY_MSG::ConsoleHandle, EmptyCommandHistory(), _CONSOLE_EXPUNGECOMMANDHISTORY_MSG::Exe, _CONSOLE_EXPUNGECOMMANDHISTORY_MSG::ExeLength, FindExeCommandHistory(), NT_SUCCESS, NTSTATUS(), Status, _CONSOLE_EXPUNGECOMMANDHISTORY_MSG::UnicodeExe, and UnlockConsole().

01397 { 01398 PCONSOLE_EXPUNGECOMMANDHISTORY_MSG a = (PCONSOLE_EXPUNGECOMMANDHISTORY_MSG)&m->u.ApiMessageData; 01399 PCONSOLE_INFORMATION Console; 01400 NTSTATUS Status; 01401 01402 Status = ApiPreamble(a->ConsoleHandle, 01403 &Console 01404 ); 01405 if (!NT_SUCCESS(Status)) { 01406 return Status; 01407 } 01408 01409 if (!CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 01410 UnlockConsole(Console); 01411 return STATUS_INVALID_PARAMETER; 01412 } 01413 01414 EmptyCommandHistory(FindExeCommandHistory(Console, 01415 a->Exe, 01416 a->ExeLength, 01417 a->UnicodeExe)); 01418 UnlockConsole(Console); 01419 return STATUS_SUCCESS; 01420 UNREFERENCED_PARAMETER(ReplyStatus); 01421 }

ULONG SrvFillConsoleOutput IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1568 of file directio.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_FILLCONSOLEOUTPUT_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_FILLCONSOLEOUTPUT_MSG::Element, _CONSOLE_FILLCONSOLEOUTPUT_MSG::ElementType, FillOutput, _CONSOLE_FILLCONSOLEOUTPUT_MSG::Length, NT_SUCCESS, NTSTATUS(), _CONSOLE_FILLCONSOLEOUTPUT_MSG::OutputHandle, Status, UnlockConsole(), and _CONSOLE_FILLCONSOLEOUTPUT_MSG::WriteCoord.

01572 { 01573 PCONSOLE_FILLCONSOLEOUTPUT_MSG a = (PCONSOLE_FILLCONSOLEOUTPUT_MSG)&m->u.ApiMessageData; 01574 NTSTATUS Status; 01575 PCONSOLE_INFORMATION Console; 01576 PHANDLE_DATA HandleData; 01577 01578 Status = ApiPreamble(a->ConsoleHandle, 01579 &Console 01580 ); 01581 if (!NT_SUCCESS(Status)) { 01582 return Status; 01583 } 01584 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01585 a->OutputHandle, 01586 CONSOLE_OUTPUT_HANDLE, 01587 GENERIC_WRITE, 01588 &HandleData 01589 ); 01590 if (!NT_SUCCESS(Status)) { 01591 a->Length = 0; 01592 } else { 01593 Status = FillOutput(HandleData->Buffer.ScreenBuffer, 01594 a->Element, 01595 a->WriteCoord, 01596 a->ElementType, 01597 &a->Length 01598 ); 01599 } 01600 UnlockConsole(Console); 01601 return Status; 01602 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01603 }

ULONG SrvFlushConsoleInputBuffer IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 524 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_FLUSHINPUTBUFFER_MSG::ConsoleHandle, DereferenceIoHandle(), FlushInputBuffer(), _CONSOLE_FLUSHINPUTBUFFER_MSG::InputHandle, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

00528 { 00529 PCONSOLE_FLUSHINPUTBUFFER_MSG a = (PCONSOLE_FLUSHINPUTBUFFER_MSG)&m->u.ApiMessageData; 00530 NTSTATUS Status; 00531 PCONSOLE_INFORMATION Console; 00532 PHANDLE_DATA HandleData; 00533 00534 Status = ApiPreamble(a->ConsoleHandle, 00535 &Console 00536 ); 00537 if (!NT_SUCCESS(Status)) { 00538 return Status; 00539 } 00540 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00541 a->InputHandle, 00542 CONSOLE_INPUT_HANDLE, 00543 GENERIC_WRITE, 00544 &HandleData 00545 ); 00546 if (NT_SUCCESS(Status)) { 00547 Status = FlushInputBuffer(HandleData->Buffer.InputBuffer); 00548 } 00549 UnlockConsole(Console); 00550 return((ULONG) Status); 00551 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00552 }

ULONG SrvFreeConsole IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1608 of file srvinit.c.

References ASSERT, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_CLIENTPROCESSID, CONSOLE_GETCONSOLEAPPFROMPROCESSDATA, CONSOLE_GETCONSOLEHANDLEFROMPROCESSDATA, CONSOLE_PERPROCESSDATA, CONSOLE_SETCONSOLEAPP, _CONSOLE_FREE_MSG::ConsoleHandle, FALSE, NT_SUCCESS, NTSTATUS(), PCONSOLE_FREE_MSG, RemoveConsole(), and Status.

01612 { 01613 PCONSOLE_FREE_MSG a = (PCONSOLE_FREE_MSG)&m->u.ApiMessageData; 01614 PCONSOLE_PER_PROCESS_DATA ProcessData; 01615 NTSTATUS Status; 01616 01617 ProcessData = CONSOLE_PERPROCESSDATA(); 01618 ASSERT (CONSOLE_GETCONSOLEAPPFROMPROCESSDATA(ProcessData)); 01619 01620 ASSERT(CONSOLE_GETCONSOLEHANDLEFROMPROCESSDATA(ProcessData)==a->ConsoleHandle); 01621 01622 Status = RemoveConsole(ProcessData, 01623 CONSOLE_CLIENTPROCESSHANDLE(), 01624 CONSOLE_CLIENTPROCESSID()); 01625 01626 if (NT_SUCCESS(Status)) { 01627 CONSOLE_SETCONSOLEAPP(FALSE); 01628 } 01629 01630 return Status; 01631 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01632 }

ULONG SrvGenerateConsoleCtrlEvent IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 444 of file ntcon/server/getset.c.

References ApiPreamble(), CONSOLE_PROCESS_HANDLE, _CONSOLE_CTRLEVENT_MSG::ConsoleHandle, _CONSOLE_CTRLEVENT_MSG::CtrlEvent, HandleCtrlEvent(), _CONSOLE_INFORMATION::LimitingProcessId, NT_SUCCESS, NTSTATUS(), PCONSOLE_PROCESS_HANDLE, _CONSOLE_PROCESS_HANDLE::Process, _CONSOLE_CTRLEVENT_MSG::ProcessGroupId, _CONSOLE_INFORMATION::ProcessHandleList, Status, and UnlockConsole().

00448 { 00449 PCONSOLE_CTRLEVENT_MSG a = (PCONSOLE_CTRLEVENT_MSG)&m->u.ApiMessageData; 00450 NTSTATUS Status; 00451 PCONSOLE_INFORMATION Console; 00452 00453 Status = ApiPreamble(a->ConsoleHandle, 00454 &Console 00455 ); 00456 if (!NT_SUCCESS(Status)) { 00457 return Status; 00458 } 00459 try { 00460 // 00461 // Make sure the process group id is valid 00462 // 00463 if (a->ProcessGroupId) { 00464 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00465 PLIST_ENTRY ListHead, ListNext; 00466 00467 Status = STATUS_INVALID_PARAMETER; 00468 ListHead = &Console->ProcessHandleList; 00469 ListNext = ListHead->Flink; 00470 while (ListNext != ListHead) { 00471 ProcessHandleRecord = CONTAINING_RECORD( ListNext, CONSOLE_PROCESS_HANDLE, ListLink ); 00472 ListNext = ListNext->Flink; 00473 if (ProcessHandleRecord->Process->ProcessGroupId == a->ProcessGroupId) { 00474 Status = STATUS_SUCCESS; 00475 break; 00476 } 00477 } 00478 } 00479 if (NT_SUCCESS(Status)) { 00480 Console->LimitingProcessId = a->ProcessGroupId; 00481 HandleCtrlEvent(Console, a->CtrlEvent); 00482 } 00483 00484 } finally { 00485 UnlockConsole(Console); 00486 } 00487 return Status; 00488 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00489 }

ULONG SrvGetConsoleAlias IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 731 of file server/cmdline.c.

References ApiPreamble(), BYTE, CHAR_COUNT, _CONSOLE_GETALIAS_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, ConvertInputToUnicode(), ConvertToOem(), _CONSOLE_INFORMATION::CP, _CONSOLE_GETALIAS_MSG::Exe, _CONSOLE_GETALIAS_MSG::ExeLength, FindAlias(), FindExe(), L, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_GETALIAS_MSG::Source, _CONSOLE_GETALIAS_MSG::SourceLength, Status, _ALIAS::Target, _CONSOLE_GETALIAS_MSG::Target, _ALIAS::TargetLength, _CONSOLE_GETALIAS_MSG::TargetLength, TMP_TAG, _CONSOLE_GETALIAS_MSG::Unicode, _CONSOLE_GETALIAS_MSG::UnicodeExe, UnlockConsole(), and USHORT.

00738 : 00739 00740 This routine get a command line alias from the global set. 00741 00742 Arguments: 00743 00744 m - message containing api parameters 00745 00746 ReplyStatus - Indicates whether to reply to the dll port. 00747 00748 Return Value: 00749 00750 --*/ 00751 00752 { 00753 00754 NTSTATUS Status; 00755 PCONSOLE_GETALIAS_MSG a = (PCONSOLE_GETALIAS_MSG)&m->u.ApiMessageData; 00756 PALIAS Alias; 00757 PCONSOLE_INFORMATION Console; 00758 PEXE_ALIAS_LIST ExeAliasList; 00759 LPWSTR Source,Target; 00760 00761 Status = ApiPreamble(a->ConsoleHandle, 00762 &Console 00763 ); 00764 if (!NT_SUCCESS(Status)) { 00765 return Status; 00766 } 00767 00768 if (!CsrValidateMessageBuffer(m, &a->Source, a->SourceLength, sizeof(BYTE)) || 00769 !CsrValidateMessageBuffer(m, &a->Target, a->TargetLength, sizeof(BYTE)) || 00770 !CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 00771 00772 UnlockConsole(Console); 00773 return STATUS_INVALID_PARAMETER; 00774 } 00775 00776 if (a->Unicode) { 00777 Source = a->Source; 00778 Target = a->Target; 00779 } else { 00780 Source = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),a->SourceLength*sizeof(WCHAR)); 00781 if (Source == NULL) { 00782 UnlockConsole(Console); 00783 return (ULONG)STATUS_NO_MEMORY; 00784 } 00785 Target = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),a->TargetLength*sizeof(WCHAR)); 00786 if (Target == NULL) { 00787 ConsoleHeapFree(Source); 00788 UnlockConsole(Console); 00789 return (ULONG)STATUS_NO_MEMORY; 00790 } 00791 a->TargetLength = (USHORT)(a->TargetLength * sizeof(WCHAR)); 00792 a->SourceLength = (USHORT)ConvertInputToUnicode(Console->CP, 00793 a->Source, 00794 a->SourceLength, 00795 Source, 00796 a->SourceLength); 00797 a->SourceLength *= 2; 00798 } 00799 ExeAliasList = FindExe(Console,a->Exe,a->ExeLength,a->UnicodeExe); 00800 if (ExeAliasList) { 00801 Alias = FindAlias(ExeAliasList,Source,a->SourceLength); 00802 if (Alias) { 00803 if (Alias->TargetLength + sizeof(WCHAR) > a->TargetLength) { 00804 Status = STATUS_BUFFER_TOO_SMALL; 00805 } else { 00806 a->TargetLength = Alias->TargetLength + sizeof(WCHAR); 00807 RtlCopyMemory(Target,Alias->Target,Alias->TargetLength); 00808 Target[Alias->TargetLength/sizeof(WCHAR)] = L'\0'; 00809 } 00810 } else { 00811 Status = STATUS_UNSUCCESSFUL; 00812 } 00813 } else { 00814 Status = STATUS_UNSUCCESSFUL; 00815 } 00816 if (!a->Unicode) { 00817 if (NT_SUCCESS(Status)) { 00818 a->TargetLength = (USHORT)ConvertToOem(Console->CP, 00819 Target, 00820 a->TargetLength / sizeof(WCHAR), 00821 a->Target, 00822 CHAR_COUNT(a->TargetLength) 00823 ); 00824 } 00825 ConsoleHeapFree(Source); 00826 ConsoleHeapFree(Target); 00827 } 00828 UnlockConsole(Console); 00829 return Status; 00830 UNREFERENCED_PARAMETER(ReplyStatus); 00831 }

DWORD SrvGetConsoleAliases IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 903 of file server/cmdline.c.

References _CONSOLE_GETALIASES_MSG::AliasesBuffer, _CONSOLE_GETALIASES_MSG::AliasesBufferLength, _EXE_ALIAS_LIST::AliasList, ApiPreamble(), BYTE, CHAR, CHAR_COUNT, _CONSOLE_GETALIASES_MSG::ConsoleHandle, ConvertToOem(), _CONSOLE_INFORMATION::CP, DWORD, _CONSOLE_GETALIASES_MSG::Exe, _CONSOLE_GETALIASES_MSG::ExeLength, FindExe(), NT_SUCCESS, NTSTATUS(), _ALIAS::Source, _ALIAS::SourceLength, Status, _ALIAS::Target, _ALIAS::TargetLength, _CONSOLE_GETALIASES_MSG::Unicode, _CONSOLE_GETALIASES_MSG::UnicodeExe, UnlockConsole(), and USHORT.

00907 { 00908 PCONSOLE_GETALIASES_MSG a = (PCONSOLE_GETALIASES_MSG)&m->u.ApiMessageData; 00909 PCONSOLE_INFORMATION Console; 00910 PEXE_ALIAS_LIST ExeAliasList; 00911 PALIAS Alias; 00912 PLIST_ENTRY ListHead, ListNext; 00913 DWORD AliasesBufferLength; 00914 LPWSTR AliasesBufferPtrW; 00915 LPSTR AliasesBufferPtrA; 00916 NTSTATUS Status; 00917 00918 Status = ApiPreamble(a->ConsoleHandle, 00919 &Console 00920 ); 00921 if (!NT_SUCCESS(Status)) { 00922 return Status; 00923 } 00924 00925 if (!CsrValidateMessageBuffer(m, &a->AliasesBuffer, a->AliasesBufferLength, sizeof(BYTE)) || 00926 !CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 00927 00928 UnlockConsole(Console); 00929 return STATUS_INVALID_PARAMETER; 00930 } 00931 00932 AliasesBufferLength = a->AliasesBufferLength; 00933 if (a->Unicode) { 00934 AliasesBufferPtrW = a->AliasesBuffer; 00935 } else { 00936 AliasesBufferPtrA = a->AliasesBuffer; 00937 } 00938 a->AliasesBufferLength = 0; 00939 ExeAliasList = FindExe(Console,a->Exe,a->ExeLength,a->UnicodeExe); 00940 if (ExeAliasList) { 00941 ListHead = &ExeAliasList->AliasList; 00942 ListNext = ListHead->Flink; 00943 while (ListNext != ListHead) { 00944 Alias = CONTAINING_RECORD( ListNext, ALIAS, ListLink ); 00945 if (a->Unicode) { 00946 if ((a->AliasesBufferLength + Alias->SourceLength + Alias->TargetLength + (2*sizeof(WCHAR))) 00947 <= AliasesBufferLength) { 00948 RtlCopyMemory(AliasesBufferPtrW,Alias->Source,Alias->SourceLength); 00949 AliasesBufferPtrW+=Alias->SourceLength/sizeof(WCHAR); 00950 *AliasesBufferPtrW++= (WCHAR)'='; 00951 RtlCopyMemory(AliasesBufferPtrW,Alias->Target,Alias->TargetLength); 00952 AliasesBufferPtrW+=Alias->TargetLength/sizeof(WCHAR); 00953 *AliasesBufferPtrW++= (WCHAR)'\0'; 00954 a->AliasesBufferLength += Alias->SourceLength + Alias->TargetLength + (2*sizeof(WCHAR)); // +2 is for = and term null 00955 } else { 00956 UnlockConsole(Console); 00957 return (ULONG)STATUS_BUFFER_OVERFLOW; 00958 } 00959 } else { 00960 if ((a->AliasesBufferLength + ((Alias->SourceLength + Alias->TargetLength)/sizeof(WCHAR)) + (2*sizeof(CHAR))) 00961 <= AliasesBufferLength) { 00962 USHORT SourceLength,TargetLength; 00963 SourceLength = (USHORT)ConvertToOem(Console->CP, 00964 Alias->Source, 00965 Alias->SourceLength / sizeof(WCHAR), 00966 AliasesBufferPtrA, 00967 CHAR_COUNT(Alias->SourceLength) 00968 ); 00969 AliasesBufferPtrA+=SourceLength; 00970 *AliasesBufferPtrA++ = '='; 00971 TargetLength = (USHORT)ConvertToOem(Console->CP, 00972 Alias->Target, 00973 Alias->TargetLength / sizeof(WCHAR), 00974 AliasesBufferPtrA, 00975 CHAR_COUNT(Alias->TargetLength) 00976 ); 00977 AliasesBufferPtrA+=TargetLength; 00978 *AliasesBufferPtrA++= '\0'; 00979 a->AliasesBufferLength += SourceLength + TargetLength + (2*sizeof(CHAR)); // +2 is for = and term null 00980 } else { 00981 UnlockConsole(Console); 00982 return (ULONG)STATUS_BUFFER_OVERFLOW; 00983 } 00984 } 00985 ListNext = ListNext->Flink; 00986 } 00987 } 00988 UnlockConsole(Console); 00989 return STATUS_SUCCESS; 00990 UNREFERENCED_PARAMETER(ReplyStatus); 00991 }

DWORD SrvGetConsoleAliasesLength IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 834 of file server/cmdline.c.

References _CONSOLE_GETALIASESLENGTH_MSG::AliasesLength, _EXE_ALIAS_LIST::AliasList, ApiPreamble(), BYTE, _CONSOLE_GETALIASESLENGTH_MSG::ConsoleHandle, _CONSOLE_GETALIASESLENGTH_MSG::Exe, _CONSOLE_GETALIASESLENGTH_MSG::ExeLength, FindExe(), NT_SUCCESS, NTSTATUS(), _ALIAS::SourceLength, Status, _ALIAS::TargetLength, _CONSOLE_GETALIASESLENGTH_MSG::Unicode, _CONSOLE_GETALIASESLENGTH_MSG::UnicodeExe, and UnlockConsole().

00838 { 00839 PCONSOLE_GETALIASESLENGTH_MSG a = (PCONSOLE_GETALIASESLENGTH_MSG)&m->u.ApiMessageData; 00840 PCONSOLE_INFORMATION Console; 00841 PEXE_ALIAS_LIST ExeAliasList; 00842 PALIAS Alias; 00843 PLIST_ENTRY ListHead, ListNext; 00844 NTSTATUS Status; 00845 00846 Status = ApiPreamble(a->ConsoleHandle, 00847 &Console 00848 ); 00849 if (!NT_SUCCESS(Status)) { 00850 return Status; 00851 } 00852 00853 if (!CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 00854 UnlockConsole(Console); 00855 return STATUS_INVALID_PARAMETER; 00856 } 00857 00858 a->AliasesLength = 0; 00859 ExeAliasList = FindExe(Console,a->Exe,a->ExeLength,a->UnicodeExe); 00860 if (ExeAliasList) { 00861 ListHead = &ExeAliasList->AliasList; 00862 ListNext = ListHead->Flink; 00863 while (ListNext != ListHead) { 00864 Alias = CONTAINING_RECORD( ListNext, ALIAS, ListLink ); 00865 a->AliasesLength += Alias->SourceLength + Alias->TargetLength + (2*sizeof(WCHAR)); // +2 is for = and term null 00866 ListNext = ListNext->Flink; 00867 } 00868 } 00869 if (!a->Unicode) { 00870 a->AliasesLength /= sizeof(WCHAR); 00871 } 00872 UnlockConsole(Console); 00873 return STATUS_SUCCESS; 00874 UNREFERENCED_PARAMETER(ReplyStatus); 00875 }

DWORD SrvGetConsoleAliasExes IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1029 of file server/cmdline.c.

References _CONSOLE_GETALIASEXES_MSG::AliasExesBuffer, _CONSOLE_GETALIASEXES_MSG::AliasExesBufferLength, ApiPreamble(), BYTE, CHAR, CHAR_COUNT, _CONSOLE_GETALIASEXES_MSG::ConsoleHandle, ConvertToOem(), _CONSOLE_INFORMATION::CP, DWORD, _CONSOLE_INFORMATION::ExeAliasList, _EXE_ALIAS_LIST::ExeLength, _EXE_ALIAS_LIST::ExeName, NT_SUCCESS, NTSTATUS(), Status, _CONSOLE_GETALIASEXES_MSG::Unicode, UnlockConsole(), and USHORT.

01033 { 01034 PCONSOLE_GETALIASEXES_MSG a = (PCONSOLE_GETALIASEXES_MSG)&m->u.ApiMessageData; 01035 PCONSOLE_INFORMATION Console; 01036 PEXE_ALIAS_LIST AliasList; 01037 PLIST_ENTRY ListHead, ListNext; 01038 DWORD AliasExesBufferLength; 01039 LPWSTR AliasExesBufferPtrW; 01040 LPSTR AliasExesBufferPtrA; 01041 NTSTATUS Status; 01042 01043 Status = ApiPreamble(a->ConsoleHandle, 01044 &Console 01045 ); 01046 if (!NT_SUCCESS(Status)) { 01047 return Status; 01048 } 01049 01050 if (!CsrValidateMessageBuffer(m, &a->AliasExesBuffer, a->AliasExesBufferLength, sizeof(BYTE))) { 01051 UnlockConsole(Console); 01052 return STATUS_INVALID_PARAMETER; 01053 } 01054 01055 AliasExesBufferLength = a->AliasExesBufferLength; 01056 if (a->Unicode) { 01057 AliasExesBufferPtrW = a->AliasExesBuffer; 01058 } else { 01059 AliasExesBufferPtrA = a->AliasExesBuffer; 01060 } 01061 a->AliasExesBufferLength = 0; 01062 ListHead = &Console->ExeAliasList; 01063 ListNext = ListHead->Flink; 01064 while (ListNext != ListHead) { 01065 AliasList = CONTAINING_RECORD( ListNext, EXE_ALIAS_LIST, ListLink ); 01066 if (a->Unicode) { 01067 if ((a->AliasExesBufferLength + AliasList->ExeLength + (1*sizeof(WCHAR))) 01068 <= AliasExesBufferLength) { 01069 RtlCopyMemory(AliasExesBufferPtrW,AliasList->ExeName,AliasList->ExeLength); 01070 AliasExesBufferPtrW+=AliasList->ExeLength/sizeof(WCHAR); 01071 *AliasExesBufferPtrW++= (WCHAR)'\0'; 01072 a->AliasExesBufferLength += AliasList->ExeLength + (1*sizeof(WCHAR)); // +1 is term null 01073 } else { 01074 UnlockConsole(Console); 01075 return (ULONG)STATUS_BUFFER_OVERFLOW; 01076 } 01077 } else { 01078 if ((a->AliasExesBufferLength + (AliasList->ExeLength/sizeof(WCHAR)) + (1*sizeof(CHAR))) 01079 <= AliasExesBufferLength) { 01080 USHORT Length; 01081 Length = (USHORT)ConvertToOem(Console->CP, 01082 AliasList->ExeName, 01083 AliasList->ExeLength / sizeof(WCHAR), 01084 AliasExesBufferPtrA, 01085 CHAR_COUNT(AliasList->ExeLength) 01086 ); 01087 AliasExesBufferPtrA+=Length; 01088 *AliasExesBufferPtrA++= (WCHAR)'\0'; 01089 a->AliasExesBufferLength += Length + (1*sizeof(CHAR)); // +1 is term null 01090 } else { 01091 UnlockConsole(Console); 01092 return (ULONG)STATUS_BUFFER_OVERFLOW; 01093 } 01094 } 01095 ListNext = ListNext->Flink; 01096 } 01097 UnlockConsole(Console); 01098 return STATUS_SUCCESS; 01099 UNREFERENCED_PARAMETER(ReplyStatus); 01100 }

DWORD SrvGetConsoleAliasExesLength IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 994 of file server/cmdline.c.

References _CONSOLE_GETALIASEXESLENGTH_MSG::AliasExesLength, ApiPreamble(), _CONSOLE_GETALIASEXESLENGTH_MSG::ConsoleHandle, _CONSOLE_INFORMATION::ExeAliasList, _EXE_ALIAS_LIST::ExeLength, NT_SUCCESS, NTSTATUS(), Status, _CONSOLE_GETALIASEXESLENGTH_MSG::Unicode, and UnlockConsole().

00998 { 00999 PCONSOLE_GETALIASEXESLENGTH_MSG a = (PCONSOLE_GETALIASEXESLENGTH_MSG)&m->u.ApiMessageData; 01000 PCONSOLE_INFORMATION Console; 01001 PEXE_ALIAS_LIST AliasList; 01002 PLIST_ENTRY ListHead, ListNext; 01003 NTSTATUS Status; 01004 01005 Status = ApiPreamble(a->ConsoleHandle, 01006 &Console 01007 ); 01008 if (!NT_SUCCESS(Status)) { 01009 return Status; 01010 } 01011 01012 a->AliasExesLength = 0; 01013 ListHead = &Console->ExeAliasList; 01014 ListNext = ListHead->Flink; 01015 while (ListNext != ListHead) { 01016 AliasList = CONTAINING_RECORD( ListNext, EXE_ALIAS_LIST, ListLink ); 01017 a->AliasExesLength += AliasList->ExeLength + (1*sizeof(WCHAR)); // +1 for term null 01018 ListNext = ListNext->Flink; 01019 } 01020 if (!a->Unicode) { 01021 a->AliasExesLength /= sizeof(WCHAR); 01022 } 01023 UnlockConsole(Console); 01024 return STATUS_SUCCESS; 01025 UNREFERENCED_PARAMETER(ReplyStatus); 01026 }

DWORD SrvGetConsoleCommandHistory IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1500 of file server/cmdline.c.

References ApiPreamble(), BYTE, CHAR, CHAR_COUNT, _COMMAND::Command, _CONSOLE_GETCOMMANDHISTORY_MSG::CommandBuffer, _CONSOLE_GETCOMMANDHISTORY_MSG::CommandBufferLength, _COMMAND::CommandLength, _COMMAND_HISTORY::Commands, _CONSOLE_GETCOMMANDHISTORY_MSG::ConsoleHandle, ConvertToOem(), _CONSOLE_INFORMATION::CP, _CONSOLE_GETCOMMANDHISTORY_MSG::Exe, _CONSOLE_GETCOMMANDHISTORY_MSG::ExeLength, FindExeCommandHistory(), NT_SUCCESS, NTSTATUS(), _COMMAND_HISTORY::NumberOfCommands, SHORT, Status, _CONSOLE_GETCOMMANDHISTORY_MSG::Unicode, _CONSOLE_GETCOMMANDHISTORY_MSG::UnicodeExe, UnlockConsole(), and USHORT.

01504 { 01505 PCONSOLE_GETCOMMANDHISTORY_MSG a = (PCONSOLE_GETCOMMANDHISTORY_MSG)&m->u.ApiMessageData; 01506 PCONSOLE_INFORMATION Console; 01507 NTSTATUS Status; 01508 SHORT i,CommandHistoryLength; 01509 PCOMMAND_HISTORY CommandHistory; 01510 PWCHAR CommandBufferW; 01511 PCHAR CommandBufferA; 01512 01513 Status = ApiPreamble(a->ConsoleHandle, 01514 &Console 01515 ); 01516 if (!NT_SUCCESS(Status)) { 01517 return Status; 01518 } 01519 01520 if (!CsrValidateMessageBuffer(m, &a->CommandBuffer, a->CommandBufferLength, sizeof(BYTE)) || 01521 !CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 01522 01523 UnlockConsole(Console); 01524 return STATUS_INVALID_PARAMETER; 01525 } 01526 01527 if (a->Unicode) { 01528 CommandBufferW=a->CommandBuffer; 01529 } else { 01530 CommandBufferA=a->CommandBuffer; 01531 } 01532 CommandHistoryLength=0; 01533 CommandHistory=FindExeCommandHistory(Console, 01534 a->Exe, 01535 a->ExeLength, 01536 a->UnicodeExe); 01537 if (CommandHistory) { 01538 for (i=0;i<CommandHistory->NumberOfCommands;i++) { 01539 if (a->Unicode) { 01540 if ((CommandHistoryLength+CommandHistory->Commands[i]->CommandLength+sizeof(WCHAR)) <= a->CommandBufferLength) { 01541 RtlCopyMemory(CommandBufferW,CommandHistory->Commands[i]->Command,CommandHistory->Commands[i]->CommandLength); 01542 CommandBufferW+=CommandHistory->Commands[i]->CommandLength/sizeof(WCHAR); 01543 *CommandBufferW++=(WCHAR)'\0'; 01544 CommandHistoryLength+=CommandHistory->Commands[i]->CommandLength+sizeof(WCHAR); 01545 } else { 01546 Status = STATUS_BUFFER_OVERFLOW; 01547 break; 01548 } 01549 } else { 01550 if ((CommandHistoryLength+(CommandHistory->Commands[i]->CommandLength/sizeof(WCHAR))+sizeof(CHAR)) <= a->CommandBufferLength) { 01551 USHORT Length; 01552 Length = (USHORT)ConvertToOem(Console->CP, 01553 CommandHistory->Commands[i]->Command, 01554 CommandHistory->Commands[i]->CommandLength / sizeof(WCHAR), 01555 CommandBufferA, 01556 CHAR_COUNT(CommandHistory->Commands[i]->CommandLength) 01557 ); 01558 CommandBufferA+=Length; 01559 *CommandBufferA++=(WCHAR)'\0'; 01560 CommandHistoryLength+=CommandHistory->Commands[i]->CommandLength+sizeof(WCHAR); 01561 } else { 01562 Status = STATUS_BUFFER_OVERFLOW; 01563 break; 01564 } 01565 } 01566 } 01567 } 01568 a->CommandBufferLength=CommandHistoryLength; 01569 UnlockConsole(Console); 01570 return Status; 01571 UNREFERENCED_PARAMETER(ReplyStatus); 01572 }

DWORD SrvGetConsoleCommandHistoryLength IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1458 of file server/cmdline.c.

References ApiPreamble(), BYTE, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::CommandHistoryLength, _COMMAND::CommandLength, _COMMAND_HISTORY::Commands, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::ConsoleHandle, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::Exe, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::ExeLength, FindExeCommandHistory(), NT_SUCCESS, NTSTATUS(), _COMMAND_HISTORY::NumberOfCommands, SHORT, Status, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::Unicode, _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG::UnicodeExe, and UnlockConsole().

01462 { 01463 PCONSOLE_GETCOMMANDHISTORYLENGTH_MSG a = (PCONSOLE_GETCOMMANDHISTORYLENGTH_MSG)&m->u.ApiMessageData; 01464 PCONSOLE_INFORMATION Console; 01465 NTSTATUS Status; 01466 SHORT i; 01467 PCOMMAND_HISTORY CommandHistory; 01468 01469 Status = ApiPreamble(a->ConsoleHandle, 01470 &Console 01471 ); 01472 if (!NT_SUCCESS(Status)) { 01473 return Status; 01474 } 01475 01476 if (!CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 01477 UnlockConsole(Console); 01478 return STATUS_INVALID_PARAMETER; 01479 } 01480 01481 a->CommandHistoryLength=0; 01482 CommandHistory=FindExeCommandHistory(Console, 01483 a->Exe, 01484 a->ExeLength, 01485 a->UnicodeExe); 01486 if (CommandHistory) { 01487 for (i=0;i<CommandHistory->NumberOfCommands;i++) { 01488 a->CommandHistoryLength+=CommandHistory->Commands[i]->CommandLength+sizeof(WCHAR); 01489 } 01490 } 01491 if (!a->Unicode) { 01492 a->CommandHistoryLength /= sizeof(WCHAR); 01493 } 01494 UnlockConsole(Console); 01495 return STATUS_SUCCESS; 01496 UNREFERENCED_PARAMETER(ReplyStatus); 01497 }

ULONG SrvGetConsoleCP IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1359 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_GETCP_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CP, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETCP_MSG::Output, _CONSOLE_INFORMATION::OutputCP, Status, UnlockConsole(), and _CONSOLE_GETCP_MSG::wCodePageID.

01363 { 01364 PCONSOLE_GETCP_MSG a = (PCONSOLE_GETCP_MSG)&m->u.ApiMessageData; 01365 NTSTATUS Status; 01366 PCONSOLE_INFORMATION Console; 01367 01368 Status = ApiPreamble(a->ConsoleHandle, 01369 &Console 01370 ); 01371 if (!NT_SUCCESS(Status)) { 01372 return Status; 01373 } 01374 if (a->Output) { 01375 a->wCodePageID = Console->OutputCP; 01376 } else { 01377 a->wCodePageID = Console->CP; 01378 } 01379 UnlockConsole(Console); 01380 return STATUS_SUCCESS; 01381 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01382 }

ULONG SrvGetConsoleCurrentFont IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 315 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETCURRENTFONT_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_GETCURRENTFONT_MSG::FontIndex, _CONSOLE_GETCURRENTFONT_MSG::FontSize, GetCurrentFont(), _CONSOLE_GETCURRENTFONT_MSG::MaximumWindow, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETCURRENTFONT_MSG::OutputHandle, Status, and UnlockConsole().

00319 { 00320 PCONSOLE_GETCURRENTFONT_MSG a = (PCONSOLE_GETCURRENTFONT_MSG)&m->u.ApiMessageData; 00321 NTSTATUS Status; 00322 PCONSOLE_INFORMATION Console; 00323 PHANDLE_DATA HandleData; 00324 00325 Status = ApiPreamble(a->ConsoleHandle, 00326 &Console 00327 ); 00328 if (!NT_SUCCESS(Status)) { 00329 return Status; 00330 } 00331 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00332 a->OutputHandle, 00333 CONSOLE_OUTPUT_HANDLE, 00334 GENERIC_READ, 00335 &HandleData 00336 ); 00337 if (NT_SUCCESS(Status)) { 00338 if (HandleData->Buffer.ScreenBuffer->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00339 Status = STATUS_FULLSCREEN_MODE; 00340 } else { 00341 Status = GetCurrentFont(HandleData->Buffer.ScreenBuffer, 00342 a->MaximumWindow, 00343 &a->FontIndex, 00344 &a->FontSize 00345 ); 00346 } 00347 } 00348 UnlockConsole(Console); 00349 return((ULONG) Status); 00350 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00351 }

ULONG SrvGetConsoleCursorInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 179 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETCURSORINFO_MSG::ConsoleHandle, _CONSOLE_GETCURSORINFO_MSG::CursorSize, DereferenceIoHandle(), NT_SUCCESS, NTSTATUS(), _CONSOLE_GETCURSORINFO_MSG::OutputHandle, Status, UnlockConsole(), and _CONSOLE_GETCURSORINFO_MSG::Visible.

00183 { 00184 PCONSOLE_GETCURSORINFO_MSG a = (PCONSOLE_GETCURSORINFO_MSG)&m->u.ApiMessageData; 00185 NTSTATUS Status; 00186 PCONSOLE_INFORMATION Console; 00187 PHANDLE_DATA HandleData; 00188 00189 Status = ApiPreamble(a->ConsoleHandle, 00190 &Console 00191 ); 00192 if (!NT_SUCCESS(Status)) { 00193 return Status; 00194 } 00195 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00196 a->OutputHandle, 00197 CONSOLE_OUTPUT_HANDLE, 00198 GENERIC_READ, 00199 &HandleData 00200 ); 00201 if (NT_SUCCESS(Status)) { 00202 a->CursorSize = HandleData->Buffer.ScreenBuffer->BufferInfo.TextInfo.CursorSize; 00203 a->Visible = (BOOLEAN) HandleData->Buffer.ScreenBuffer->BufferInfo.TextInfo.CursorVisible; 00204 } 00205 UnlockConsole(Console); 00206 return((ULONG) Status); 00207 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00208 }

ULONG SrvGetConsoleDisplayMode IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2355 of file server/private.c.

References ApiPreamble(), _CONSOLE_GETDISPLAYMODE_MSG::ConsoleHandle, _CONSOLE_INFORMATION::FullScreenFlags, _CONSOLE_GETDISPLAYMODE_MSG::ModeFlags, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

02359 { 02360 PCONSOLE_GETDISPLAYMODE_MSG a = (PCONSOLE_GETDISPLAYMODE_MSG)&m->u.ApiMessageData; 02361 NTSTATUS Status; 02362 PCONSOLE_INFORMATION Console; 02363 02364 Status = ApiPreamble(a->ConsoleHandle, 02365 &Console 02366 ); 02367 if (NT_SUCCESS(Status)) { 02368 a->ModeFlags = Console->FullScreenFlags; 02369 UnlockConsole(Console); 02370 } 02371 return Status; 02372 UNREFERENCED_PARAMETER(ReplyStatus); 02373 }

ULONG SrvGetConsoleFontInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 233 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, _CONSOLE_GETFONTINFO_MSG::BufPtr, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETFONTINFO_MSG::ConsoleHandle, DereferenceIoHandle(), GetAvailableFonts(), _CONSOLE_GETFONTINFO_MSG::MaximumWindow, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETFONTINFO_MSG::NumFonts, _CONSOLE_GETFONTINFO_MSG::OutputHandle, Status, and UnlockConsole().

00237 { 00238 PCONSOLE_GETFONTINFO_MSG a = (PCONSOLE_GETFONTINFO_MSG)&m->u.ApiMessageData; 00239 NTSTATUS Status; 00240 PCONSOLE_INFORMATION Console; 00241 PHANDLE_DATA HandleData; 00242 00243 Status = ApiPreamble(a->ConsoleHandle, 00244 &Console 00245 ); 00246 if (!NT_SUCCESS(Status)) { 00247 return Status; 00248 } 00249 00250 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumFonts, sizeof(*a->BufPtr))) { 00251 UnlockConsole(Console); 00252 return STATUS_INVALID_PARAMETER; 00253 } 00254 00255 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00256 a->OutputHandle, 00257 CONSOLE_OUTPUT_HANDLE, 00258 GENERIC_READ, 00259 &HandleData 00260 ); 00261 if (NT_SUCCESS(Status)) { 00262 if (HandleData->Buffer.ScreenBuffer->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00263 Status = STATUS_FULLSCREEN_MODE; 00264 } else { 00265 Status = GetAvailableFonts(HandleData->Buffer.ScreenBuffer, 00266 a->MaximumWindow, 00267 a->BufPtr, 00268 &a->NumFonts 00269 ); 00270 } 00271 } 00272 UnlockConsole(Console); 00273 return((ULONG) Status); 00274 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00275 }

ULONG SrvGetConsoleFontSize IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 278 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETFONTSIZE_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_GETFONTSIZE_MSG::FontIndex, _CONSOLE_GETFONTSIZE_MSG::FontSize, GetFontSize(), NT_SUCCESS, NTSTATUS(), _CONSOLE_GETFONTSIZE_MSG::OutputHandle, Status, and UnlockConsole().

00282 { 00283 PCONSOLE_GETFONTSIZE_MSG a = (PCONSOLE_GETFONTSIZE_MSG)&m->u.ApiMessageData; 00284 NTSTATUS Status; 00285 PCONSOLE_INFORMATION Console; 00286 PHANDLE_DATA HandleData; 00287 00288 Status = ApiPreamble(a->ConsoleHandle, 00289 &Console 00290 ); 00291 if (!NT_SUCCESS(Status)) { 00292 return Status; 00293 } 00294 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00295 a->OutputHandle, 00296 CONSOLE_OUTPUT_HANDLE, 00297 GENERIC_READ, 00298 &HandleData 00299 ); 00300 if (NT_SUCCESS(Status)) { 00301 if (HandleData->Buffer.ScreenBuffer->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00302 Status = STATUS_FULLSCREEN_MODE; 00303 } else { 00304 Status = GetFontSize(a->FontIndex, 00305 &a->FontSize 00306 ); 00307 } 00308 } 00309 UnlockConsole(Console); 00310 return((ULONG) Status); 00311 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00312 }

ULONG SrvGetConsoleHardwareState IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2232 of file server/private.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::BufferInfo, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETHARDWARESTATE_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_GETHARDWARESTATE_MSG::FontSize, _MODE_FONT_PAIR::FontSize, ModeFontPairs, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETHARDWARESTATE_MSG::OutputHandle, RegModeFontPairs, _CONSOLE_GETHARDWARESTATE_MSG::Resolution, _MODE_FONT_PAIR::Resolution, Status, and UnlockConsole().

02236 { 02237 #ifdef i386 02238 PCONSOLE_GETHARDWARESTATE_MSG a = (PCONSOLE_GETHARDWARESTATE_MSG)&m->u.ApiMessageData; 02239 NTSTATUS Status; 02240 PCONSOLE_INFORMATION Console; 02241 PHANDLE_DATA HandleData; 02242 PSCREEN_INFORMATION ScreenInfo; 02243 02244 Status = ApiPreamble(a->ConsoleHandle, 02245 &Console 02246 ); 02247 if (!NT_SUCCESS(Status)) { 02248 return Status; 02249 } 02250 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 02251 a->OutputHandle, 02252 CONSOLE_OUTPUT_HANDLE, 02253 GENERIC_READ, 02254 &HandleData 02255 ); 02256 if (NT_SUCCESS(Status)) { 02257 ScreenInfo = HandleData->Buffer.ScreenBuffer; 02258 if (ScreenInfo->BufferInfo.TextInfo.ModeIndex == -1) { 02259 UnlockConsole(Console); 02260 return (ULONG)STATUS_UNSUCCESSFUL; 02261 } 02262 #if defined(FE_SB) 02263 a->Resolution = RegModeFontPairs[ScreenInfo->BufferInfo.TextInfo.ModeIndex].Resolution; 02264 a->FontSize = RegModeFontPairs[ScreenInfo->BufferInfo.TextInfo.ModeIndex].FontSize; 02265 #else 02266 a->Resolution = ModeFontPairs[ScreenInfo->BufferInfo.TextInfo.ModeIndex].Resolution; 02267 a->FontSize = ModeFontPairs[ScreenInfo->BufferInfo.TextInfo.ModeIndex].FontSize; 02268 #endif 02269 } 02270 UnlockConsole(Console); 02271 return Status; 02272 #else 02273 return (ULONG)STATUS_UNSUCCESSFUL; 02274 UNREFERENCED_PARAMETER(m); // get rid of unreferenced parameter warning message 02275 #endif 02276 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02277 }

ULONG SrvGetConsoleInput IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 556 of file directio.c.

References ApiPreamble(), Buffer, _HANDLE_DATA::Buffer, _CONSOLE_GETCONSOLEINPUT_MSG::BufPtr, _DIRECT_READ_DATA::Console, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_STATUS_WAIT, _CONSOLE_GETCONSOLEINPUT_MSG::ConsoleHandle, DereferenceIoHandle(), DIRECT_READ_DATA, DirectReadWaitRoutine(), FALSE, _CONSOLE_GETCONSOLEINPUT_MSG::Flags, HANDLE_TO_INDEX, _DIRECT_READ_DATA::HandleIndex, INPUT_RECORD_BUFFER_SIZE, _CONSOLE_GETCONSOLEINPUT_MSG::InputHandle, _DIRECT_READ_DATA::InputInfo, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_GETCONSOLEINPUT_MSG::NumRecords, _DIRECT_READ_DATA::ProcessData, ReadInputBuffer(), _CONSOLE_GETCONSOLEINPUT_MSG::Record, Status, TranslateInputToOem(), TRUE, _CONSOLE_GETCONSOLEINPUT_MSG::Unicode, and UnlockConsole().

00563 : 00564 00565 This routine reads or peeks input events. In both cases, the events 00566 are copied to the user's buffer. In the read case they are removed 00567 from the input buffer and in the peek case they are not. 00568 00569 Arguments: 00570 00571 m - message containing api parameters 00572 00573 ReplyStatus - Indicates whether to reply to the dll port. 00574 00575 Return Value: 00576 00577 --*/ 00578 00579 { 00580 PCONSOLE_GETCONSOLEINPUT_MSG a = (PCONSOLE_GETCONSOLEINPUT_MSG)&m->u.ApiMessageData; 00581 PCONSOLE_INFORMATION Console; 00582 PHANDLE_DATA HandleData; 00583 NTSTATUS Status; 00584 PINPUT_RECORD Buffer; 00585 DIRECT_READ_DATA DirectReadData; 00586 #ifdef FE_SB 00587 BOOLEAN fAddDbcsLead = FALSE; 00588 PDWORD nLength; 00589 #endif 00590 00591 if (a->Flags & ~CONSOLE_READ_VALID) { 00592 return (ULONG)STATUS_INVALID_PARAMETER; 00593 } 00594 00595 Status = ApiPreamble(a->ConsoleHandle, 00596 &Console 00597 ); 00598 if (!NT_SUCCESS(Status)) { 00599 return Status; 00600 } 00601 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00602 a->InputHandle, 00603 CONSOLE_INPUT_HANDLE, 00604 GENERIC_READ, 00605 &HandleData 00606 ); 00607 if (!NT_SUCCESS(Status)) { 00608 a->NumRecords = 0; 00609 } else { 00610 00611 if (a->NumRecords <= INPUT_RECORD_BUFFER_SIZE) { 00612 Buffer = a->Record; 00613 } else { 00614 Buffer = a->BufPtr; 00615 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumRecords, sizeof(*Buffer))) { 00616 UnlockConsole(Console); 00617 return STATUS_INVALID_PARAMETER; 00618 } 00619 } 00620 00621 // 00622 // if we're reading, wait for data. if we're peeking, don't. 00623 // 00624 00625 DirectReadData.InputInfo = HandleData->Buffer.InputBuffer; 00626 DirectReadData.Console = Console; 00627 DirectReadData.ProcessData = CONSOLE_PERPROCESSDATA(); 00628 DirectReadData.HandleIndex = HANDLE_TO_INDEX(a->InputHandle); 00629 #if defined(FE_SB) 00630 if (CONSOLE_IS_DBCS_CP(Console) ) { 00631 Console->ReadConInpNumBytesUnicode = a->NumRecords; 00632 if (!a->Unicode) { 00633 /* 00634 * ASCII : a->NumRecords is ASCII byte count 00635 */ 00636 if (HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte.Event.KeyEvent.uChar.AsciiChar) { 00637 /* 00638 * Saved DBCS Traling byte 00639 */ 00640 *Buffer = HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte; 00641 if (!(a->Flags & CONSOLE_READ_NOREMOVE)) 00642 RtlZeroMemory(&HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte,sizeof(INPUT_RECORD)); 00643 00644 if (Console->ReadConInpNumBytesUnicode == 1) { 00645 UnlockConsole(Console); 00646 return STATUS_SUCCESS; 00647 } 00648 else { 00649 Console->ReadConInpNumBytesUnicode--; 00650 Buffer++; 00651 fAddDbcsLead = TRUE; 00652 nLength = &Console->ReadConInpNumBytesUnicode; 00653 } 00654 } 00655 else { 00656 nLength = &Console->ReadConInpNumBytesUnicode; 00657 } 00658 } 00659 else { 00660 nLength = &a->NumRecords; 00661 } 00662 } 00663 else { 00664 nLength = &a->NumRecords; 00665 } 00666 Status = ReadInputBuffer(HandleData->Buffer.InputBuffer, 00667 Buffer, 00668 nLength, 00669 !!(a->Flags & CONSOLE_READ_NOREMOVE), 00670 !(a->Flags & CONSOLE_READ_NOWAIT), 00671 FALSE, 00672 Console, 00673 HandleData, 00674 m, 00675 DirectReadWaitRoutine, 00676 &DirectReadData, 00677 sizeof(DirectReadData), 00678 FALSE, 00679 a->Unicode 00680 ); 00681 if (Status == CONSOLE_STATUS_WAIT) { 00682 *ReplyStatus = CsrReplyPending; 00683 } else if (!a->Unicode) { 00684 a->NumRecords = TranslateInputToOem(Console, 00685 Buffer, 00686 fAddDbcsLead ? 00687 a->NumRecords-1 : 00688 a->NumRecords, 00689 Console->ReadConInpNumBytesUnicode, 00690 a->Flags & CONSOLE_READ_NOREMOVE ? 00691 NULL : 00692 &HandleData->Buffer.InputBuffer->ReadConInpDbcsLeadByte 00693 ); 00694 if (fAddDbcsLead) 00695 { 00696 a->NumRecords++; 00697 Buffer--; 00698 } 00699 } 00700 #else 00701 Status = ReadInputBuffer(HandleData->Buffer.InputBuffer, 00702 Buffer, 00703 &a->NumRecords, 00704 !!(a->Flags & CONSOLE_READ_NOREMOVE), 00705 !(a->Flags & CONSOLE_READ_NOWAIT), 00706 FALSE, 00707 Console, 00708 HandleData, 00709 m, 00710 DirectReadWaitRoutine, 00711 &DirectReadData, 00712 sizeof(DirectReadData), 00713 FALSE 00714 ); 00715 if (Status == CONSOLE_STATUS_WAIT) { 00716 *ReplyStatus = CsrReplyPending; 00717 } else if (!a->Unicode) { 00718 TranslateInputToOem(Console, 00719 Buffer, 00720 a->NumRecords 00721 ); 00722 } 00723 #endif 00724 } 00725 UnlockConsole(Console); 00726 return Status; 00727 }

ULONG SrvGetConsoleKeyboardLayoutName IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1385 of file ntcon/server/getset.c.

References _CONSOLE_GETKEYBOARDLAYOUTNAME_MSG::achLayout, ActivateKeyboardLayout, ApiPreamble(), _CONSOLE_GETKEYBOARDLAYOUTNAME_MSG::awchLayout, _CONSOLE_GETKEYBOARDLAYOUTNAME_MSG::bAnsi, _CONSOLE_GETKEYBOARDLAYOUTNAME_MSG::ConsoleHandle, FALSE, GetNonBiDiKeyboardLayout(), _CONSOLE_INFORMATION::hklActive, NT_SUCCESS, NTSTATUS(), NULL, Status, SystemParametersInfo(), and UnlockConsole().

01389 { 01390 PCONSOLE_GETKEYBOARDLAYOUTNAME_MSG a = (PCONSOLE_GETKEYBOARDLAYOUTNAME_MSG)&m->u.ApiMessageData; 01391 NTSTATUS Status; 01392 PCONSOLE_INFORMATION Console; 01393 01394 Status = ApiPreamble(a->ConsoleHandle, 01395 &Console 01396 ); 01397 if (!NT_SUCCESS(Status)) { 01398 return Status; 01399 } 01400 if (Console->hklActive == NULL) { 01401 // 01402 // hklActive is not set yet. Let's initialize it here. 01403 // 01404 extern void GetNonBiDiKeyboardLayout(HKL * phklActive); 01405 01406 RIPMSG1(RIP_WARNING, "SrvGetConsoleKeyboardLayoutName: hklActive is not initialized. pCon=%p", Console); 01407 01408 SystemParametersInfo(SPI_GETDEFAULTINPUTLANG, 0, &Console->hklActive, FALSE); 01409 GetNonBiDiKeyboardLayout(&Console->hklActive); 01410 } 01411 ActivateKeyboardLayout(Console->hklActive, 0); 01412 if (a->bAnsi) { 01413 GetKeyboardLayoutNameA(a->achLayout); 01414 } else { 01415 GetKeyboardLayoutNameW(a->awchLayout); 01416 } 01417 UnlockConsole(Console); 01418 return STATUS_SUCCESS; 01419 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01420 }

ULONG SrvGetConsoleLangId IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2680 of file srvinit.c.

References ApiPreamble(), _CONSOLE_LANGID_MSG::ConsoleHandle, GetConsoleLangId(), _CONSOLE_LANGID_MSG::LangId, NT_SUCCESS, NTSTATUS(), _CONSOLE_INFORMATION::OutputCP, PCONSOLE_LANGID_MSG, Status, and UnlockConsole().

02684 { 02685 PCONSOLE_LANGID_MSG a = (PCONSOLE_LANGID_MSG)&m->u.ApiMessageData; 02686 NTSTATUS Status; 02687 PCONSOLE_INFORMATION Console; 02688 02689 Status = ApiPreamble(a->ConsoleHandle, 02690 &Console 02691 ); 02692 if (!NT_SUCCESS(Status)) { 02693 return Status; 02694 } 02695 Status = GetConsoleLangId(Console->OutputCP, &a->LangId); 02696 02697 UnlockConsole(Console); 02698 return((ULONG) Status); 02699 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02700 }

ULONG SrvGetConsoleMode IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 33 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_ANY_HANDLE, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_QUICK_EDIT_MODE, CONSOLE_USE_PRIVATE_FLAGS, _CONSOLE_MODE_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_INFORMATION::Flags, _CONSOLE_MODE_MSG::Handle, _HANDLE_DATA::HandleType, _CONSOLE_INFORMATION::InsertMode, _CONSOLE_MODE_MSG::Mode, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

00037 { 00038 PCONSOLE_MODE_MSG a = (PCONSOLE_MODE_MSG)&m->u.ApiMessageData; 00039 NTSTATUS Status; 00040 PCONSOLE_INFORMATION Console; 00041 PHANDLE_DATA HandleData; 00042 00043 Status = ApiPreamble(a->ConsoleHandle, 00044 &Console 00045 ); 00046 if (!NT_SUCCESS(Status)) { 00047 return Status; 00048 } 00049 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00050 a->Handle, 00051 CONSOLE_ANY_HANDLE, 00052 GENERIC_READ, 00053 &HandleData 00054 ); 00055 if (NT_SUCCESS(Status)) { 00056 00057 // 00058 // check handle type and access 00059 // 00060 00061 if (HandleData->HandleType & CONSOLE_INPUT_HANDLE) { 00062 a->Mode = HandleData->Buffer.InputBuffer->InputMode; 00063 if (Console->Flags & CONSOLE_USE_PRIVATE_FLAGS) { 00064 a->Mode |= ENABLE_PRIVATE_FLAGS; 00065 if (Console->InsertMode) { 00066 a->Mode |= ENABLE_INSERT_MODE; 00067 } 00068 if (Console->Flags & CONSOLE_QUICK_EDIT_MODE) { 00069 a->Mode |= ENABLE_QUICK_EDIT_MODE; 00070 } 00071 } 00072 } else { 00073 a->Mode = HandleData->Buffer.ScreenBuffer->OutputMode; 00074 } 00075 } 00076 UnlockConsole(Console); 00077 return((ULONG) Status); 00078 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00079 }

ULONG SrvGetConsoleMouseInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 211 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_GETMOUSEINFO_MSG::ConsoleHandle, GetMouseButtons(), NT_SUCCESS, NTSTATUS(), _CONSOLE_GETMOUSEINFO_MSG::NumButtons, Status, and UnlockConsole().

00215 { 00216 PCONSOLE_GETMOUSEINFO_MSG a = (PCONSOLE_GETMOUSEINFO_MSG)&m->u.ApiMessageData; 00217 NTSTATUS Status; 00218 PCONSOLE_INFORMATION Console; 00219 00220 Status = ApiPreamble(a->ConsoleHandle, 00221 &Console 00222 ); 00223 if (!NT_SUCCESS(Status)) { 00224 return Status; 00225 } 00226 Status = GetMouseButtons(&a->NumButtons); 00227 UnlockConsole(Console); 00228 return Status; 00229 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00230 }

ULONG SrvGetConsoleNumberOfFonts IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 82 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_GETNUMBEROFFONTS_MSG::ConsoleHandle, _CONSOLE_INFORMATION::FullScreenFlags, GetNumFonts(), NT_SUCCESS, NTSTATUS(), _CONSOLE_GETNUMBEROFFONTS_MSG::NumberOfFonts, Status, and UnlockConsole().

00086 { 00087 PCONSOLE_GETNUMBEROFFONTS_MSG a = (PCONSOLE_GETNUMBEROFFONTS_MSG)&m->u.ApiMessageData; 00088 NTSTATUS Status; 00089 PCONSOLE_INFORMATION Console; 00090 00091 Status = ApiPreamble(a->ConsoleHandle, 00092 &Console 00093 ); 00094 if (!NT_SUCCESS(Status)) { 00095 return Status; 00096 } 00097 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00098 Status = STATUS_FULLSCREEN_MODE; 00099 } else { 00100 Status = GetNumFonts(&a->NumberOfFonts); 00101 } 00102 UnlockConsole(Console); 00103 return Status; 00104 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00105 }

ULONG SrvGetConsoleNumberOfInputEvents IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 108 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETNUMBEROFINPUTEVENTS_MSG::ConsoleHandle, DereferenceIoHandle(), GetNumberOfReadyEvents(), _CONSOLE_GETNUMBEROFINPUTEVENTS_MSG::InputHandle, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETNUMBEROFINPUTEVENTS_MSG::ReadyEvents, Status, and UnlockConsole().

00112 { 00113 PCONSOLE_GETNUMBEROFINPUTEVENTS_MSG a = (PCONSOLE_GETNUMBEROFINPUTEVENTS_MSG)&m->u.ApiMessageData; 00114 NTSTATUS Status; 00115 PCONSOLE_INFORMATION Console; 00116 PHANDLE_DATA HandleData; 00117 00118 Status = ApiPreamble(a->ConsoleHandle, 00119 &Console 00120 ); 00121 if (!NT_SUCCESS(Status)) { 00122 return Status; 00123 } 00124 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00125 a->InputHandle, 00126 CONSOLE_INPUT_HANDLE, 00127 GENERIC_READ, 00128 &HandleData 00129 ); 00130 if (NT_SUCCESS(Status)) { 00131 Status = GetNumberOfReadyEvents(HandleData->Buffer.InputBuffer, 00132 &a->ReadyEvents 00133 ); 00134 } 00135 UnlockConsole(Console); 00136 return((ULONG) Status); 00137 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00138 }

ULONG SrvGetConsoleScreenBufferInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 141 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_GETSCREENBUFFERINFO_MSG::Attributes, _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETSCREENBUFFERINFO_MSG::ConsoleHandle, _CONSOLE_GETSCREENBUFFERINFO_MSG::CurrentWindowSize, _CONSOLE_GETSCREENBUFFERINFO_MSG::CursorPosition, DereferenceIoHandle(), GetScreenBufferInformation(), _CONSOLE_GETSCREENBUFFERINFO_MSG::MaximumWindowSize, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETSCREENBUFFERINFO_MSG::OutputHandle, _CONSOLE_GETSCREENBUFFERINFO_MSG::ScrollPosition, _CONSOLE_GETSCREENBUFFERINFO_MSG::Size, Status, and UnlockConsole().

00145 { 00146 PCONSOLE_GETSCREENBUFFERINFO_MSG a = (PCONSOLE_GETSCREENBUFFERINFO_MSG)&m->u.ApiMessageData; 00147 NTSTATUS Status; 00148 PCONSOLE_INFORMATION Console; 00149 PHANDLE_DATA HandleData; 00150 00151 Status = ApiPreamble(a->ConsoleHandle, 00152 &Console 00153 ); 00154 if (!NT_SUCCESS(Status)) { 00155 return Status; 00156 } 00157 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00158 a->OutputHandle, 00159 CONSOLE_OUTPUT_HANDLE, 00160 GENERIC_READ, 00161 &HandleData 00162 ); 00163 if (NT_SUCCESS(Status)) { 00164 Status = GetScreenBufferInformation(HandleData->Buffer.ScreenBuffer, 00165 &a->Size, 00166 &a->CursorPosition, 00167 &a->ScrollPosition, 00168 &a->Attributes, 00169 &a->CurrentWindowSize, 00170 &a->MaximumWindowSize 00171 ); 00172 } 00173 UnlockConsole(Console); 00174 return((ULONG) Status); 00175 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00176 }

ULONG SrvGetConsoleTitle IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 4879 of file server/cmdline.c.

References ApiPreamble(), BYTE, _CONSOLE_GETTITLE_MSG::ConsoleHandle, ConvertToOem(), _CONSOLE_INFORMATION::CP, NT_SUCCESS, NTSTATUS(), OEMCP, Status, _CONSOLE_INFORMATION::Title, _CONSOLE_GETTITLE_MSG::Title, _CONSOLE_INFORMATION::TitleLength, _CONSOLE_GETTITLE_MSG::TitleLength, _CONSOLE_GETTITLE_MSG::Unicode, UnlockConsole(), and USHORT.

04883 { 04884 PCONSOLE_GETTITLE_MSG a = (PCONSOLE_GETTITLE_MSG)&m->u.ApiMessageData; 04885 NTSTATUS Status; 04886 PCONSOLE_INFORMATION Console; 04887 04888 Status = ApiPreamble(a->ConsoleHandle, 04889 &Console 04890 ); 04891 if (!NT_SUCCESS(Status)) { 04892 return Status; 04893 } 04894 04895 if (!CsrValidateMessageBuffer(m, &a->Title, a->TitleLength, sizeof(BYTE))) { 04896 UnlockConsole(Console); 04897 return STATUS_INVALID_PARAMETER; 04898 } 04899 04900 // a->TitleLength contains length in bytes 04901 if (a->Unicode) { 04902 if ((USHORT)a->TitleLength > Console->TitleLength) { 04903 a->TitleLength = Console->TitleLength; 04904 } 04905 RtlCopyMemory(a->Title,Console->Title,a->TitleLength); 04906 } else { 04907 #if defined(FE_SB) 04908 a->TitleLength = (USHORT)ConvertToOem(OEMCP, 04909 Console->Title, 04910 Console->TitleLength / sizeof(WCHAR), 04911 a->Title, 04912 a->TitleLength 04913 ); 04914 #else 04915 a->TitleLength = (USHORT)ConvertToOem(Console->CP, 04916 Console->Title, 04917 Console->TitleLength / sizeof(WCHAR), 04918 a->Title, 04919 a->TitleLength 04920 ); 04921 #endif 04922 } 04923 UnlockConsole(Console); 04924 return STATUS_SUCCESS; 04925 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 04926 }

ULONG SrvGetConsoleWindow IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1424 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_GETCONSOLEWINDOW_MSG::ConsoleHandle, _CONSOLE_GETCONSOLEWINDOW_MSG::hwnd, _CONSOLE_INFORMATION::hWnd, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

01428 { 01429 PCONSOLE_GETCONSOLEWINDOW_MSG a = (PCONSOLE_GETCONSOLEWINDOW_MSG)&m->u.ApiMessageData; 01430 NTSTATUS Status; 01431 PCONSOLE_INFORMATION Console; 01432 01433 Status = ApiPreamble(a->ConsoleHandle, 01434 &Console 01435 ); 01436 if (!NT_SUCCESS(Status)) { 01437 return Status; 01438 } 01439 01440 a->hwnd = Console->hWnd; 01441 01442 UnlockConsole(Console); 01443 return STATUS_SUCCESS; 01444 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01445 }

ULONG SrvGetHandleInformation IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2747 of file server/stream.c.

References ApiPreamble(), CONSOLE_INHERITABLE, CONSOLE_PERPROCESSDATA, _CONSOLE_GETHANDLEINFORMATION_MSG::ConsoleHandle, DereferenceIoHandleNoCheck(), _CONSOLE_GETHANDLEINFORMATION_MSG::Flags, _CONSOLE_GETHANDLEINFORMATION_MSG::Handle, HANDLE_TO_INDEX, _HANDLE_DATA::HandleType, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

02754 : 02755 02756 This gets information about an input or output handle. 02757 02758 Arguments: 02759 02760 ApiMessageData - Points to parameter structure. 02761 02762 Return Value: 02763 02764 --*/ 02765 02766 { 02767 PCONSOLE_GETHANDLEINFORMATION_MSG a = (PCONSOLE_GETHANDLEINFORMATION_MSG)&m->u.ApiMessageData; 02768 PCONSOLE_INFORMATION Console; 02769 PHANDLE_DATA HandleData; 02770 NTSTATUS Status; 02771 02772 Status = ApiPreamble(a->ConsoleHandle, 02773 &Console 02774 ); 02775 if (!NT_SUCCESS(Status)) { 02776 return Status; 02777 } 02778 Status = DereferenceIoHandleNoCheck(CONSOLE_PERPROCESSDATA(), 02779 HANDLE_TO_INDEX(a->Handle), 02780 &HandleData 02781 ); 02782 if (NT_SUCCESS(Status)) { 02783 a->Flags = 0; 02784 if (HandleData->HandleType & CONSOLE_INHERITABLE) { 02785 a->Flags |= HANDLE_FLAG_INHERIT; 02786 } 02787 } 02788 UnlockConsole(Console); 02789 return Status; 02790 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02791 }

ULONG SrvGetLargestConsoleWindowSize IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 555 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::Console, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_TEXTMODE_BUFFER, _CONSOLE_GETLARGESTWINDOWSIZE_MSG::ConsoleHandle, DereferenceIoHandle(), _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, _WINDOW_LIMITS::FullScreenSize, GetWindowLimits(), NT_SUCCESS, NTSTATUS(), _CONSOLE_GETLARGESTWINDOWSIZE_MSG::OutputHandle, SCR_FONTSIZE(), SHORT, _CONSOLE_GETLARGESTWINDOWSIZE_MSG::Size, Status, UnlockConsole(), and WINDOW_LIMITS.

00559 { 00560 PCONSOLE_GETLARGESTWINDOWSIZE_MSG a = (PCONSOLE_GETLARGESTWINDOWSIZE_MSG)&m->u.ApiMessageData; 00561 NTSTATUS Status; 00562 PCONSOLE_INFORMATION Console; 00563 PHANDLE_DATA HandleData; 00564 PSCREEN_INFORMATION ScreenInfo; 00565 WINDOW_LIMITS WindowLimits; 00566 00567 Status = ApiPreamble(a->ConsoleHandle, 00568 &Console 00569 ); 00570 if (!NT_SUCCESS(Status)) { 00571 return Status; 00572 } 00573 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00574 a->OutputHandle, 00575 CONSOLE_OUTPUT_HANDLE, 00576 GENERIC_WRITE, 00577 &HandleData 00578 ); 00579 if (NT_SUCCESS(Status)) { 00580 COORD FontSize; 00581 00582 ScreenInfo = HandleData->Buffer.ScreenBuffer; 00583 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 00584 a->Size.X = 80; 00585 #if defined(FE_SB) 00586 a->Size.Y = CONSOLE_IS_DBCS_OUTPUTCP(Console)?25:50; 00587 #else 00588 a->Size.Y = 50; 00589 #endif 00590 } else { 00591 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00592 FontSize = SCR_FONTSIZE(ScreenInfo); 00593 } else { 00594 FontSize.X = 1; 00595 FontSize.Y = 1; 00596 } 00597 GetWindowLimits(ScreenInfo, &WindowLimits); 00598 a->Size.X = (SHORT)(WindowLimits.FullScreenSize.X / FontSize.X); 00599 a->Size.Y = (SHORT)(WindowLimits.FullScreenSize.Y / FontSize.Y); 00600 } 00601 } 00602 UnlockConsole(Console); 00603 return((ULONG) Status); 00604 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00605 }

ULONG SrvInvalidateBitMapRect IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 168 of file w32/ntcon/server/bitmap.c.

References ApiPreamble(), ASSERT, _HANDLE_DATA::Buffer, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_IS_DBCS_ENABLED, CONSOLE_OEMFONT_DISPLAY, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_INVALIDATERECT_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CP, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandle(), _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, _HANDLE_DATA::HandleType, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_INFORMATION::OutputCP, _CONSOLE_INVALIDATERECT_MSG::OutputHandle, PBYTE, PCONSOLE_INVALIDATERECT_MSG, _CONSOLE_INVALIDATERECT_MSG::Rect, Status, UINT, UnlockConsole(), USACP, _CONSOLE_INFORMATION::VDMBuffer, _CONSOLE_INFORMATION::VDMBufferSize, WINDOWSCP, WriteRectToScreenBuffer, and WriteToScreen.

00175 : 00176 00177 This routine is called to indicate that the application has modified a region 00178 in the bitmap. We update the region to the screen. 00179 00180 Arguments: 00181 00182 m - message containing api parameters 00183 00184 ReplyStatus - Indicates whether to reply to the dll port. 00185 00186 Return Value: 00187 00188 --*/ 00189 00190 { 00191 PCONSOLE_INVALIDATERECT_MSG a = (PCONSOLE_INVALIDATERECT_MSG)&m->u.ApiMessageData; 00192 PCONSOLE_INFORMATION Console; 00193 PHANDLE_DATA HandleData; 00194 NTSTATUS Status; 00195 UINT Codepage; 00196 00197 Status = ApiPreamble(a->ConsoleHandle, 00198 &Console 00199 ); 00200 if (!NT_SUCCESS(Status)) { 00201 return Status; 00202 } 00203 00204 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00205 a->OutputHandle, 00206 CONSOLE_OUTPUT_HANDLE | CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00207 GENERIC_WRITE, 00208 &HandleData 00209 ); 00210 if (!NT_SUCCESS(Status)) { 00211 UnlockConsole(Console); 00212 return((ULONG) Status); 00213 } 00214 if (HandleData->HandleType & CONSOLE_OUTPUT_HANDLE) { 00215 //ASSERT(Console->Flags & CONSOLE_VDM_REGISTERED); 00216 //ASSERT(!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)); 00217 ASSERT(Console->VDMBuffer != NULL); 00218 if (Console->VDMBuffer != NULL) { 00219 //ASSERT(HandleData->Buffer.ScreenBuffer->ScreenBufferSize.X <= Console->VDMBufferSize.X); 00220 //ASSERT(HandleData->Buffer.ScreenBuffer->ScreenBufferSize.Y <= Console->VDMBufferSize.Y); 00221 if (HandleData->Buffer.ScreenBuffer->ScreenBufferSize.X <= Console->VDMBufferSize.X && 00222 HandleData->Buffer.ScreenBuffer->ScreenBufferSize.Y <= Console->VDMBufferSize.Y) { 00223 COORD TargetPoint; 00224 00225 TargetPoint.X = a->Rect.Left; 00226 TargetPoint.Y = a->Rect.Top; 00227 // VDM can sometimes get out of sync with window size 00228 //ASSERT(a->Rect.Left >= 0); 00229 //ASSERT(a->Rect.Top >= 0); 00230 //ASSERT(a->Rect.Right < HandleData->Buffer.ScreenBuffer->ScreenBufferSize.X); 00231 //ASSERT(a->Rect.Bottom < HandleData->Buffer.ScreenBuffer->ScreenBufferSize.Y); 00232 //ASSERT(a->Rect.Left <= a->Rect.Right); 00233 //ASSERT(a->Rect.Top <= a->Rect.Bottom); 00234 if ((a->Rect.Left >= 0) && 00235 (a->Rect.Top >= 0) && 00236 (a->Rect.Right < HandleData->Buffer.ScreenBuffer->ScreenBufferSize.X) && 00237 (a->Rect.Bottom < HandleData->Buffer.ScreenBuffer->ScreenBufferSize.Y) && 00238 (a->Rect.Left <= a->Rect.Right) && 00239 (a->Rect.Top <= a->Rect.Bottom) ) { 00240 00241 if ((Console->CurrentScreenBuffer->Flags & CONSOLE_OEMFONT_DISPLAY) && ((Console->FullScreenFlags & CONSOLE_FULLSCREEN) == 0)) { 00242 #if defined(FE_SB) 00243 if (CONSOLE_IS_DBCS_ENABLED() && 00244 Console->OutputCP != WINDOWSCP ) 00245 { 00246 Codepage = USACP; 00247 } 00248 else 00249 00250 #endif 00251 // we want UnicodeOem characters 00252 Codepage = WINDOWSCP; 00253 } else { 00254 #if defined(FE_SB) 00255 if (CONSOLE_IS_DBCS_ENABLED()) { 00256 Codepage = Console->OutputCP; 00257 } 00258 else 00259 #endif 00260 // we want real Unicode characters 00261 Codepage = Console->CP; 00262 } 00263 00264 WriteRectToScreenBuffer((PBYTE)Console->VDMBuffer, 00265 Console->VDMBufferSize, &a->Rect, 00266 HandleData->Buffer.ScreenBuffer, TargetPoint, 00267 Codepage); 00268 WriteToScreen(HandleData->Buffer.ScreenBuffer,&a->Rect); 00269 } else { 00270 Status = STATUS_INVALID_PARAMETER; 00271 } 00272 } else { 00273 Status = STATUS_INVALID_PARAMETER; 00274 } 00275 } else { 00276 Status = STATUS_INVALID_PARAMETER; 00277 } 00278 } else { 00279 00280 // 00281 // write data to screen 00282 // 00283 00284 WriteToScreen(HandleData->Buffer.ScreenBuffer,&a->Rect); 00285 } 00286 00287 UnlockConsole(Console); 00288 return Status; 00289 UNREFERENCED_PARAMETER(ReplyStatus); 00290 }

ULONG SrvOpenConsole IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 80 of file server/stream.c.

References AllocateIoHandle(), ApiPreamble(), ASSERT, _HANDLE_DATA::Buffer, CONSOLE_INHERITABLE, CONSOLE_INPUT_HANDLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, ConsoleAddShare(), _CONSOLE_OPENCONSOLE_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandleNoCheck(), _CONSOLE_OPENCONSOLE_MSG::DesiredAccess, FreeIoHandle(), Handle, _CONSOLE_OPENCONSOLE_MSG::Handle, _CONSOLE_OPENCONSOLE_MSG::HandleType, _HANDLE_DATA::HandleType, INDEX_TO_HANDLE, _CONSOLE_OPENCONSOLE_MSG::InheritHandle, InitializeInputHandle(), InitializeOutputHandle(), _CONSOLE_INFORMATION::InputBuffer, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_OPENCONSOLE_MSG::ShareMode, Status, and UnlockConsole().

00087 : 00088 00089 This routine returns a handle to the input buffer or active screen buffer. 00090 00091 Arguments: 00092 00093 ApiMessageData - Points to parameter structure. 00094 00095 Return Value: 00096 00097 --*/ 00098 00099 { 00100 PCONSOLE_OPENCONSOLE_MSG a = (PCONSOLE_OPENCONSOLE_MSG)&m->u.ApiMessageData; 00101 NTSTATUS Status; 00102 PCONSOLE_INFORMATION Console; 00103 HANDLE Handle; 00104 PHANDLE_DATA HandleData; 00105 PCONSOLE_PER_PROCESS_DATA ProcessData; 00106 00107 Status = ApiPreamble(a->ConsoleHandle, 00108 &Console 00109 ); 00110 if (!NT_SUCCESS(Status)) { 00111 return Status; 00112 } 00113 00114 try { 00115 Handle = (HANDLE) -1; 00116 ProcessData = CONSOLE_PERPROCESSDATA(); 00117 if (a->HandleType == CONSOLE_INPUT_HANDLE) { 00118 00119 Status = AllocateIoHandle(ProcessData, 00120 a->HandleType, 00121 &Handle 00122 ); 00123 if (!NT_SUCCESS(Status)) { 00124 leave; 00125 } 00126 Status = DereferenceIoHandleNoCheck(ProcessData, 00127 Handle, 00128 &HandleData 00129 ); 00130 ASSERT (NT_SUCCESS(Status)); 00131 if (!NT_SUCCESS(Status)) { 00132 leave; 00133 } 00134 if (!InitializeInputHandle(HandleData, 00135 &Console->InputBuffer)) { 00136 Status = STATUS_NO_MEMORY; 00137 leave; 00138 } 00139 if (a->InheritHandle) { 00140 HandleData->HandleType |= CONSOLE_INHERITABLE; 00141 } 00142 Status = ConsoleAddShare(a->DesiredAccess, 00143 a->ShareMode, 00144 &HandleData->Buffer.InputBuffer->ShareAccess, 00145 HandleData 00146 ); 00147 if (!NT_SUCCESS(Status)) { 00148 HandleData->Buffer.InputBuffer->RefCount--; 00149 leave; 00150 } 00151 } 00152 else if (a->HandleType == CONSOLE_OUTPUT_HANDLE){ 00153 PSCREEN_INFORMATION ScreenInfo; 00154 00155 // 00156 // open a handle to the active screen buffer. 00157 // 00158 00159 ScreenInfo = Console->CurrentScreenBuffer; 00160 if (ScreenInfo == NULL) { 00161 Status = STATUS_OBJECT_NAME_NOT_FOUND; 00162 leave; 00163 } 00164 Status = AllocateIoHandle(ProcessData, 00165 a->HandleType, 00166 &Handle 00167 ); 00168 if (!NT_SUCCESS(Status)) { 00169 leave; 00170 } 00171 Status = DereferenceIoHandleNoCheck(ProcessData, 00172 Handle, 00173 &HandleData 00174 ); 00175 ASSERT (NT_SUCCESS(Status)); 00176 if (!NT_SUCCESS(Status)) { 00177 leave; 00178 } 00179 InitializeOutputHandle(HandleData, ScreenInfo); 00180 if (a->InheritHandle) { 00181 HandleData->HandleType |= CONSOLE_INHERITABLE; 00182 } 00183 Status = ConsoleAddShare(a->DesiredAccess, 00184 a->ShareMode, 00185 &HandleData->Buffer.ScreenBuffer->ShareAccess, 00186 HandleData 00187 ); 00188 if (!NT_SUCCESS(Status)) { 00189 HandleData->Buffer.ScreenBuffer->RefCount--; 00190 leave; 00191 } 00192 } 00193 else { 00194 Status = STATUS_INVALID_PARAMETER; 00195 leave; 00196 } 00197 a->Handle = INDEX_TO_HANDLE(Handle); 00198 Status = STATUS_SUCCESS; 00199 } finally { 00200 if (!NT_SUCCESS(Status) && Handle != (HANDLE)-1) { 00201 FreeIoHandle(ProcessData, 00202 Handle 00203 ); 00204 } 00205 UnlockConsole(Console); 00206 } 00207 return Status; 00208 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00209 }

ULONG SrvReadConsole IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2263 of file server/stream.c.

References ApiPreamble(), Buffer, _CONSOLE_READCONSOLE_MSG::Buffer, _HANDLE_DATA::Buffer, BUFFER_SIZE, _CONSOLE_READCONSOLE_MSG::BufPtr, BYTE, _CONSOLE_READCONSOLE_MSG::CaptureBufferSize, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_STATUS_WAIT, _CONSOLE_READCONSOLE_MSG::ConsoleHandle, _CONSOLE_READCONSOLE_MSG::CtrlWakeupMask, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandle(), _CONSOLE_READCONSOLE_MSG::ExeNameLength, FindCommandHistory(), HANDLE_TO_INDEX, _CONSOLE_READCONSOLE_MSG::InitialNumBytes, _CONSOLE_READCONSOLE_MSG::InputHandle, NT_SUCCESS, NTSTATUS(), _CONSOLE_READCONSOLE_MSG::NumBytes, ReadChars(), Status, _CONSOLE_READCONSOLE_MSG::Unicode, and UnlockConsole().

02270 : 02271 02272 This routine reads characters from the input stream. 02273 02274 Arguments: 02275 02276 ApiMessageData - Points to parameter structure. 02277 02278 Return Value: 02279 02280 --*/ 02281 02282 { 02283 PCONSOLE_READCONSOLE_MSG a = (PCONSOLE_READCONSOLE_MSG)&m->u.ApiMessageData; 02284 PCONSOLE_INFORMATION Console; 02285 PHANDLE_DATA HandleData; 02286 NTSTATUS Status; 02287 PWCHAR Buffer; 02288 PCONSOLE_PER_PROCESS_DATA ProcessData; 02289 02290 Status = ApiPreamble(a->ConsoleHandle, 02291 &Console 02292 ); 02293 if (!NT_SUCCESS(Status)) { 02294 return Status; 02295 } 02296 02297 ProcessData = CONSOLE_PERPROCESSDATA(); 02298 Status = DereferenceIoHandle(ProcessData, 02299 a->InputHandle, 02300 CONSOLE_INPUT_HANDLE, 02301 GENERIC_READ, 02302 &HandleData 02303 ); 02304 if (!NT_SUCCESS(Status)) { 02305 a->NumBytes = 0; 02306 } else { 02307 02308 if (a->CaptureBufferSize <= BUFFER_SIZE) { 02309 Buffer = a->Buffer; 02310 } 02311 else { 02312 Buffer = a->BufPtr; 02313 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->CaptureBufferSize, sizeof(BYTE))) { 02314 UnlockConsole(Console); 02315 return STATUS_INVALID_PARAMETER; 02316 } 02317 } 02318 02319 #if defined(FE_SB) 02320 Console->ReadConInpNumBytesTemp = a->NumBytes / sizeof(WCHAR); 02321 #endif 02322 Status = ReadChars(HandleData->Buffer.InputBuffer, 02323 Console, 02324 ProcessData, 02325 Console->CurrentScreenBuffer, 02326 Buffer, 02327 &a->NumBytes, 02328 a->InitialNumBytes, 02329 a->CtrlWakeupMask, 02330 HandleData, 02331 FindCommandHistory(Console,CONSOLE_CLIENTPROCESSHANDLE()), 02332 m, 02333 HANDLE_TO_INDEX(a->InputHandle), 02334 a->ExeNameLength, 02335 a->Buffer, 02336 a->Unicode 02337 ); 02338 if (Status == CONSOLE_STATUS_WAIT) { 02339 *ReplyStatus = CsrReplyPending; 02340 } 02341 } 02342 UnlockConsole(Console); 02343 return((ULONG) Status); 02344 }

ULONG SrvReadConsoleOutput IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1207 of file directio.c.

References ApiPreamble(), Buffer, _HANDLE_DATA::Buffer, BufferSize, _CONSOLE_READCONSOLEOUTPUT_MSG::BufPtr, _CONSOLE_READCONSOLEOUTPUT_MSG::Char, _CONSOLE_READCONSOLEOUTPUT_MSG::CharRegion, CONSOLE_OEMFONT_DISPLAY, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_READCONSOLEOUTPUT_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, DBGOUTPUT, DereferenceIoHandle(), _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, NT_SUCCESS, NTSTATUS(), _CONSOLE_READCONSOLEOUTPUT_MSG::OutputHandle, ReadScreenBuffer(), SHORT, Status, TranslateOutputToOem(), TranslateOutputToOemUnicode(), TRUE, _CONSOLE_READCONSOLEOUTPUT_MSG::Unicode, UnlockConsole(), and USHORT.

01211 { 01212 PCONSOLE_READCONSOLEOUTPUT_MSG a = (PCONSOLE_READCONSOLEOUTPUT_MSG)&m->u.ApiMessageData; 01213 PCONSOLE_INFORMATION Console; 01214 PHANDLE_DATA HandleData; 01215 NTSTATUS Status; 01216 PCHAR_INFO Buffer; 01217 01218 DBGOUTPUT(("SrvReadConsoleOutput\n")); 01219 Status = ApiPreamble(a->ConsoleHandle, 01220 &Console 01221 ); 01222 if (!NT_SUCCESS(Status)) { 01223 return Status; 01224 } 01225 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01226 a->OutputHandle, 01227 CONSOLE_OUTPUT_HANDLE, 01228 GENERIC_READ, 01229 &HandleData 01230 ); 01231 if (!NT_SUCCESS(Status)) { 01232 // 01233 // a region of zero size is indicated by the right and bottom 01234 // coordinates being less than the left and top. 01235 // 01236 01237 a->CharRegion.Right = (USHORT) (a->CharRegion.Left-1); 01238 a->CharRegion.Bottom = (USHORT) (a->CharRegion.Top-1); 01239 } 01240 else { 01241 COORD BufferSize; 01242 01243 BufferSize.X = (SHORT)(a->CharRegion.Right - a->CharRegion.Left + 1); 01244 BufferSize.Y = (SHORT)(a->CharRegion.Bottom - a->CharRegion.Top + 1); 01245 01246 if ((BufferSize.X == 1) && (BufferSize.Y == 1)) { 01247 Buffer = &a->Char; 01248 } 01249 else { 01250 Buffer = a->BufPtr; 01251 if (!CsrValidateMessageBuffer(m, &a->BufPtr, BufferSize.X * BufferSize.Y, sizeof(*Buffer))) { 01252 UnlockConsole(Console); 01253 return STATUS_INVALID_PARAMETER; 01254 } 01255 } 01256 01257 Status = ReadScreenBuffer(HandleData->Buffer.ScreenBuffer, 01258 Buffer, 01259 &a->CharRegion 01260 ); 01261 if (!a->Unicode) { 01262 TranslateOutputToOem(Console, 01263 Buffer, 01264 BufferSize 01265 ); 01266 } else if ((Console->CurrentScreenBuffer->Flags & CONSOLE_OEMFONT_DISPLAY) && 01267 !(Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 01268 TranslateOutputToOemUnicode(Console, 01269 Buffer, 01270 BufferSize 01271 #if defined(FE_SB) 01272 , 01273 TRUE 01274 #endif 01275 ); 01276 } 01277 } 01278 UnlockConsole(Console); 01279 return Status; 01280 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01281 }

ULONG SrvReadConsoleOutputString IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1448 of file directio.c.

References ApiPreamble(), Buffer, _HANDLE_DATA::Buffer, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::BufPtr, CHAR, CONSOLE_ASCII, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::ConsoleHandle, DereferenceIoHandle(), NT_SUCCESS, NTSTATUS(), _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::NumRecords, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::OutputHandle, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::ReadCoord, ReadOutputString(), Status, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::String, _CONSOLE_READCONSOLEOUTPUTSTRING_MSG::StringType, and UnlockConsole().

01452 { 01453 NTSTATUS Status; 01454 PCONSOLE_INFORMATION Console; 01455 PHANDLE_DATA HandleData; 01456 PVOID Buffer; 01457 PCONSOLE_READCONSOLEOUTPUTSTRING_MSG a = (PCONSOLE_READCONSOLEOUTPUTSTRING_MSG)&m->u.ApiMessageData; 01458 ULONG nSize; 01459 01460 Status = ApiPreamble(a->ConsoleHandle, 01461 &Console 01462 ); 01463 if (!NT_SUCCESS(Status)) { 01464 return Status; 01465 } 01466 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01467 a->OutputHandle, 01468 CONSOLE_OUTPUT_HANDLE, 01469 GENERIC_READ, 01470 &HandleData 01471 ); 01472 if (!NT_SUCCESS(Status)) { 01473 01474 // 01475 // a region of zero size is indicated by the right and bottom 01476 // coordinates being less than the left and top. 01477 // 01478 01479 a->NumRecords = 0; 01480 } else { 01481 if (a->StringType == CONSOLE_ASCII) 01482 nSize = sizeof(CHAR); 01483 else 01484 nSize = sizeof(WORD); 01485 if ((a->NumRecords*nSize) > sizeof(a->String)) { 01486 Buffer = a->BufPtr; 01487 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumRecords, nSize)) { 01488 UnlockConsole(Console); 01489 return STATUS_INVALID_PARAMETER; 01490 } 01491 } 01492 else { 01493 Buffer = a->String; 01494 } 01495 Status = ReadOutputString(HandleData->Buffer.ScreenBuffer, 01496 Buffer, 01497 a->ReadCoord, 01498 a->StringType, 01499 &a->NumRecords 01500 ); 01501 } 01502 UnlockConsole(Console); 01503 return Status; 01504 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01505 }

ULONG SrvRegisterConsoleVDM IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1094 of file server/private.c.

References ApiPreamble(), ASSERT, _SCREEN_INFORMATION::BufferInfo, BYTE, ConnectToEmulator(), CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_CLIENTPROCESSID, CONSOLE_CONNECTED_TO_EMULATOR, CONSOLE_FULLSCREEN_NOPAINT, CONSOLE_HAS_FOCUS, CONSOLE_TEXTMODE_BUFFER, CONSOLE_VDM_REGISTERED, CONSOLE_WOW_REGISTERED, _CONSOLE_REGISTERVDM_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, _CONSOLE_REGISTERVDM_MSG::EndEvent, FALSE, _CONSOLE_INFORMATION::Flags, _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, FullScreenInitialized, _CONSOLE_INFORMATION::InputThreadInfo, MapViewOfSection(), NT_SUCCESS, NtClose(), NtDuplicateObject(), NTSTATUS(), NtUnmapViewOfSection(), NtUserConsoleControl(), NtUserSetInformationThread(), NULL, _CONSOLE_REGISTERVDM_MSG::RegisterFlags, _CONSOLE_REGISTERVDM_MSG::StartEvent, _CONSOLE_INFORMATION::StateBuffer, _CONSOLE_REGISTERVDM_MSG::StateBuffer, _CONSOLE_INFORMATION::StateBufferClient, _CONSOLE_REGISTERVDM_MSG::StateLength, _CONSOLE_INFORMATION::StateLength, _CONSOLE_INFORMATION::StateSectionHandle, _CONSOLE_REGISTERVDM_MSG::StateSectionName, _CONSOLE_REGISTERVDM_MSG::StateSectionNameLength, Status, _INPUT_THREAD_INFO::ThreadHandle, TIF_VDMAPP, TRUE, UnlockConsole(), UnregisterVDM(), _CONSOLE_INFORMATION::VDMBuffer, _CONSOLE_REGISTERVDM_MSG::VDMBuffer, _CONSOLE_INFORMATION::VDMBufferClient, _CONSOLE_INFORMATION::VDMBufferSectionHandle, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionName, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionNameLength, _CONSOLE_REGISTERVDM_MSG::VDMBufferSize, _CONSOLE_INFORMATION::VDMBufferSize, _CONSOLE_INFORMATION::VDMEndHardwareEvent, _CONSOLE_INFORMATION::VDMProcessHandle, _CONSOLE_INFORMATION::VDMProcessId, and _CONSOLE_INFORMATION::VDMStartHardwareEvent.

01098 { 01099 PCONSOLE_REGISTERVDM_MSG a = (PCONSOLE_REGISTERVDM_MSG)&m->u.ApiMessageData; 01100 NTSTATUS Status; 01101 PCONSOLE_INFORMATION Console; 01102 SIZE_T ViewSize; 01103 #ifdef i386 01104 VIDEO_REGISTER_VDM RegisterVdm; 01105 ULONG RegisterVdmSize = sizeof(RegisterVdm); 01106 VIDEO_VDM Vdm; 01107 #endif //i386 01108 Status = ApiPreamble(a->ConsoleHandle, 01109 &Console 01110 ); 01111 if (!NT_SUCCESS(Status)) { 01112 return Status; 01113 } 01114 01115 01116 if (!a->RegisterFlags) { 01117 // williamh, Jan 28 1994 01118 // do not do an assert here because we may have unregistered the ntvdm 01119 // and the ntvdm doesn't necessarily know this(and it could post another 01120 // unregistervdm). Return error here so NTVDM knows what to do 01121 // ASSERT(Console->Flags & CONSOLE_VDM_REGISTERED); 01122 01123 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01124 ASSERT(!(Console->Flags & CONSOLE_FULLSCREEN_NOPAINT)); 01125 UnregisterVDM(Console); 01126 #ifdef i386 01127 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE && 01128 Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 01129 // SetVideoMode(Console->CurrentScreenBuffer); 01130 //set up cursor 01131 SetCursorInformationHW(Console->CurrentScreenBuffer, 01132 Console->CurrentScreenBuffer->BufferInfo.TextInfo.CursorSize, 01133 Console->CurrentScreenBuffer->BufferInfo.TextInfo.CursorVisible); 01134 SetCursorPositionHW(Console->CurrentScreenBuffer, 01135 Console->CurrentScreenBuffer->BufferInfo.TextInfo.CursorPosition); 01136 } 01137 #endif 01138 Status = STATUS_SUCCESS; 01139 } else { 01140 Status = STATUS_ACCESS_DENIED; 01141 } 01142 UnlockConsole(Console); 01143 return Status; 01144 } 01145 01146 if (!CsrValidateMessageBuffer(m, &a->StateSectionName, a->StateSectionNameLength, sizeof(BYTE)) || 01147 !CsrValidateMessageBuffer(m, &a->VDMBufferSectionName, a->VDMBufferSectionNameLength, sizeof(BYTE))) { 01148 01149 UnlockConsole(Console); 01150 return STATUS_INVALID_PARAMETER; 01151 } 01152 01153 // check it out. A console should have only one VDM registered. 01154 ASSERT(!(Console->Flags & CONSOLE_VDM_REGISTERED)); 01155 01156 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01157 UnlockConsole(Console); 01158 return (ULONG) STATUS_ACCESS_DENIED; 01159 } 01160 01161 ASSERT(!Console->VDMProcessHandle); 01162 01163 Status = NtDuplicateObject(NtCurrentProcess(), CONSOLE_CLIENTPROCESSHANDLE(), 01164 NtCurrentProcess(), &Console->VDMProcessHandle, 01165 0, FALSE, DUPLICATE_SAME_ACCESS); 01166 if (!NT_SUCCESS(Status)) { 01167 UnlockConsole(Console); 01168 return Status; 01169 } 01170 Console->VDMProcessId = CONSOLE_CLIENTPROCESSID(); 01171 01172 #ifdef i386 01173 01174 Vdm.ProcessHandle = Console->VDMProcessHandle; 01175 01176 // 01177 // Assume fullscreen initialization will fail. 01178 // have state length set to zero so that NTVDM will know 01179 // full screen is disabled. 01180 // 01181 01182 a->StateLength = 0; 01183 Console->StateLength = 0; 01184 Console->StateBufferClient = NULL; 01185 01186 if (FullScreenInitialized) { 01187 01188 Status = NtDuplicateObject(CONSOLE_CLIENTPROCESSHANDLE(), 01189 a->StartEvent, 01190 NtCurrentProcess(), 01191 &Console->VDMStartHardwareEvent, 01192 0, 01193 FALSE, 01194 DUPLICATE_SAME_ACCESS 01195 ); 01196 if (NT_SUCCESS(Status)) { 01197 Status = NtDuplicateObject(CONSOLE_CLIENTPROCESSHANDLE(), 01198 a->EndEvent, 01199 NtCurrentProcess(), 01200 &Console->VDMEndHardwareEvent, 01201 0, 01202 FALSE, 01203 DUPLICATE_SAME_ACCESS 01204 ); 01205 if (NT_SUCCESS(Status)) { 01206 Status = GdiFullscreenControl(FullscreenControlRegisterVdm, 01207 &Vdm, 01208 sizeof(Vdm), 01209 &RegisterVdm, 01210 &RegisterVdmSize 01211 ); 01212 01213 if (NT_SUCCESS(Status)) { 01214 01215 // 01216 // create state section and map a view of it into server and vdm. 01217 // this section is used to get/set video hardware state during 01218 // the fullscreen<->windowed transition. we create the section 01219 // instead of the vdm for security purposes. 01220 // 01221 01222 Status = MapViewOfSection(&Console->StateSectionHandle, 01223 RegisterVdm.MinimumStateSize, 01224 &Console->StateBuffer, 01225 &ViewSize, 01226 Console->VDMProcessHandle, 01227 &a->StateBuffer 01228 ); 01229 01230 if (NT_SUCCESS(Status)) { 01231 a->StateLength = RegisterVdm.MinimumStateSize; 01232 Console->StateLength = RegisterVdm.MinimumStateSize; 01233 Console->StateBufferClient = a->StateBuffer; 01234 } 01235 01236 } else { 01237 01238 CloseHandle(Console->VDMStartHardwareEvent); 01239 CloseHandle(Console->VDMEndHardwareEvent); 01240 } 01241 01242 } else { 01243 01244 // ASSERT(FALSE); 01245 CloseHandle(Console->VDMStartHardwareEvent); 01246 CloseHandle(Console->VDMEndHardwareEvent); 01247 } 01248 01249 } else { 01250 CloseHandle(Console->VDMStartHardwareEvent); 01251 } 01252 // 01253 // if failed to duplicate screen switch events or map view 01254 // to video state shared buffer, fails this API 01255 // 01256 if (!NT_SUCCESS(Status)) { 01257 UnlockConsole(Console); 01258 return (Status); 01259 } 01260 } 01261 01262 #endif 01263 // 01264 // create vdm char section and map a view of it into server and vdm. 01265 // this section is used by the vdm to update the screen when in a 01266 // charmode window. this is a performance optimization. we create 01267 // the section instead of the vdm for security purposes. 01268 // 01269 01270 Status = MapViewOfSection(&Console->VDMBufferSectionHandle, 01271 #ifdef i386 01272 a->VDMBufferSize.X*a->VDMBufferSize.Y*2, 01273 #else //risc 01274 a->VDMBufferSize.X*a->VDMBufferSize.Y*4, 01275 #endif 01276 &Console->VDMBuffer, 01277 &ViewSize, 01278 Console->VDMProcessHandle, 01279 &a->VDMBuffer 01280 ); 01281 if (!NT_SUCCESS(Status)) { 01282 01283 Console->VDMBuffer = NULL; 01284 01285 #ifdef i386 01286 01287 if (FullScreenInitialized) { 01288 01289 NtUnmapViewOfSection(NtCurrentProcess(),Console->StateBuffer); 01290 NtUnmapViewOfSection(Console->VDMProcessHandle,Console->StateBufferClient); 01291 NtClose(Console->StateSectionHandle); 01292 CloseHandle(Console->VDMStartHardwareEvent); 01293 CloseHandle(Console->VDMEndHardwareEvent); 01294 } 01295 01296 #endif 01297 CloseHandle(Console->VDMProcessHandle); 01298 Console->VDMProcessHandle = NULL; 01299 UnlockConsole(Console); 01300 return((ULONG) Status); 01301 } 01302 Console->VDMBufferClient = a->VDMBuffer; 01303 01304 Console->Flags |= CONSOLE_VDM_REGISTERED; 01305 01306 if (Console->Flags & CONSOLE_HAS_FOCUS) { 01307 USERTHREAD_FLAGS Flags; 01308 01309 Flags.dwFlags = TIF_VDMAPP; 01310 Flags.dwMask = TIF_VDMAPP; 01311 NtUserSetInformationThread(Console->InputThreadInfo->ThreadHandle, 01312 UserThreadFlags, &Flags, sizeof(Flags)); 01313 } 01314 Console->VDMBufferSize = a->VDMBufferSize; 01315 01316 if (a->RegisterFlags & CONSOLE_REGISTER_WOW) 01317 Console->Flags |= CONSOLE_WOW_REGISTERED; 01318 else 01319 Console->Flags &= ~CONSOLE_WOW_REGISTERED; 01320 01321 // 01322 // if we're already in fullscreen and we run a DOS app for 01323 // the first time, connect the emulator. 01324 // 01325 01326 #ifdef i386 01327 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 01328 RECT CursorRect; 01329 CursorRect.left = -32767; 01330 CursorRect.top = -32767; 01331 CursorRect.right = 32767; 01332 CursorRect.bottom = 32767; 01333 NtUserConsoleControl(ConsoleSetVDMCursorBounds, &CursorRect, sizeof(RECT)); 01334 // connect emulator 01335 ASSERT(!(Console->Flags & CONSOLE_CONNECTED_TO_EMULATOR)); 01336 ConnectToEmulator(TRUE, Console); 01337 } 01338 #endif 01339 01340 UnlockConsole(Console); 01341 return Status; 01342 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01343 }

ULONG SrvScrollConsoleScreenBuffer IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 882 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CharToWchar(), _CONSOLE_SCROLLSCREENBUFFER_MSG::Clip, _CONSOLE_SCROLLSCREENBUFFER_MSG::ClipRectangle, CONSOLE_OEMFONT_DISPLAY, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SCROLLSCREENBUFFER_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandle(), _CONSOLE_SCROLLSCREENBUFFER_MSG::DestinationOrigin, _CONSOLE_SCROLLSCREENBUFFER_MSG::Fill, _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_INFORMATION::OutputCP, _CONSOLE_SCROLLSCREENBUFFER_MSG::OutputHandle, RealUnicodeToFalseUnicode(), _CONSOLE_SCROLLSCREENBUFFER_MSG::ScrollRectangle, ScrollRegion(), Status, _CONSOLE_SCROLLSCREENBUFFER_MSG::Unicode, and UnlockConsole().

00886 { 00887 PCONSOLE_SCROLLSCREENBUFFER_MSG a = (PCONSOLE_SCROLLSCREENBUFFER_MSG)&m->u.ApiMessageData; 00888 NTSTATUS Status; 00889 PCONSOLE_INFORMATION Console; 00890 PHANDLE_DATA HandleData; 00891 PSMALL_RECT ClipRect; 00892 00893 Status = ApiPreamble(a->ConsoleHandle, 00894 &Console 00895 ); 00896 if (!NT_SUCCESS(Status)) { 00897 return Status; 00898 } 00899 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00900 a->OutputHandle, 00901 CONSOLE_OUTPUT_HANDLE, 00902 GENERIC_WRITE, 00903 &HandleData 00904 ); 00905 if (NT_SUCCESS(Status)) { 00906 00907 if (a->Clip) { 00908 ClipRect = &a->ClipRectangle; 00909 } 00910 else { 00911 ClipRect = NULL; 00912 } 00913 if (!a->Unicode) { 00914 #if defined(FE_SB) 00915 a->Fill.Char.UnicodeChar = CharToWchar(Console, 00916 Console->OutputCP, 00917 &a->Fill.Char.AsciiChar); 00918 #else 00919 a->Fill.Char.UnicodeChar = CharToWchar( 00920 Console->OutputCP, a->Fill.Char.AsciiChar); 00921 #endif 00922 } else if ((Console->CurrentScreenBuffer->Flags & CONSOLE_OEMFONT_DISPLAY) && 00923 !(Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 00924 RealUnicodeToFalseUnicode(&a->Fill.Char.UnicodeChar, 00925 1, 00926 Console->OutputCP 00927 ); 00928 } 00929 Status = ScrollRegion(HandleData->Buffer.ScreenBuffer, 00930 &a->ScrollRectangle, 00931 ClipRect, 00932 a->DestinationOrigin, 00933 a->Fill 00934 ); 00935 } 00936 UnlockConsole(Console); 00937 return((ULONG) Status); 00938 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00939 }

ULONG SrvSetConsoleActiveScreenBuffer IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 492 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETACTIVESCREENBUFFER_MSG::ConsoleHandle, DereferenceIoHandle(), NT_SUCCESS, NTSTATUS(), _CONSOLE_SETACTIVESCREENBUFFER_MSG::OutputHandle, SetActiveScreenBuffer(), Status, and UnlockConsole().

00496 { 00497 PCONSOLE_SETACTIVESCREENBUFFER_MSG a = (PCONSOLE_SETACTIVESCREENBUFFER_MSG)&m->u.ApiMessageData; 00498 NTSTATUS Status; 00499 PCONSOLE_INFORMATION Console; 00500 PHANDLE_DATA HandleData; 00501 00502 Status = ApiPreamble(a->ConsoleHandle, 00503 &Console 00504 ); 00505 if (!NT_SUCCESS(Status)) { 00506 return Status; 00507 } 00508 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00509 a->OutputHandle, 00510 CONSOLE_GRAPHICS_OUTPUT_HANDLE | CONSOLE_OUTPUT_HANDLE, 00511 GENERIC_WRITE, 00512 &HandleData 00513 ); 00514 if (NT_SUCCESS(Status)) { 00515 Status = SetActiveScreenBuffer(HandleData->Buffer.ScreenBuffer); 00516 } 00517 UnlockConsole(Console); 00518 return((ULONG) Status); 00519 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00520 }

DWORD SrvSetConsoleCommandHistoryMode IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1575 of file server/cmdline.c.

References ApiPreamble(), _CONSOLE_SETCOMMANDHISTORYMODE_MSG::ConsoleHandle, _CONSOLE_SETCOMMANDHISTORYMODE_MSG::Flags, _CONSOLE_INFORMATION::InsertMode, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

01579 { 01580 PCONSOLE_SETCOMMANDHISTORYMODE_MSG a = (PCONSOLE_SETCOMMANDHISTORYMODE_MSG)&m->u.ApiMessageData; 01581 PCONSOLE_INFORMATION Console; 01582 NTSTATUS Status; 01583 01584 Status = ApiPreamble(a->ConsoleHandle, 01585 &Console 01586 ); 01587 if (!NT_SUCCESS(Status)) { 01588 return Status; 01589 } 01590 Console->InsertMode = (BOOLEAN) (a->Flags != CONSOLE_OVERSTRIKE); 01591 UnlockConsole(Console); 01592 return STATUS_SUCCESS; 01593 UNREFERENCED_PARAMETER(ReplyStatus); 01594 }

ULONG SrvSetConsoleCP IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1229 of file ntcon/server/getset.c.

References ApiPreamble(), _SCREEN_INFORMATION::BufferInfo, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_IS_DBCS_ENABLED, _CONSOLE_SETCP_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CP, _CONSOLE_INFORMATION::CurrentScreenBuffer, FALSE, _CONSOLE_INFORMATION::FullScreenFlags, IsAvailableFarEastCodePage(), NT_SUCCESS, NtClose(), NtDuplicateObject(), NtSetEvent(), NTSTATUS(), NULL, OEMCP, _CONSOLE_SETCP_MSG::Output, _CONSOLE_INFORMATION::OutputCP, QueueConsoleMessage(), ReCreateDbcsScreenBuffer(), Status, UINT, UnlockConsole(), _CONSOLE_SETCP_MSG::wCodePageID, and _SCREEN_INFORMATION::Window.

01233 { 01234 PCONSOLE_SETCP_MSG a = (PCONSOLE_SETCP_MSG)&m->u.ApiMessageData; 01235 NTSTATUS Status; 01236 PCONSOLE_INFORMATION Console; 01237 HANDLE hEvent = NULL; 01238 01239 Status = ApiPreamble(a->ConsoleHandle, 01240 &Console 01241 ); 01242 if (!NT_SUCCESS(Status)) { 01243 return Status; 01244 } 01245 if (a->hEvent) { 01246 Status = NtDuplicateObject(CONSOLE_CLIENTPROCESSHANDLE(), 01247 a->hEvent, 01248 NtCurrentProcess(), 01249 &hEvent, 01250 0, 01251 FALSE, 01252 DUPLICATE_SAME_ACCESS 01253 ); 01254 if (!NT_SUCCESS(Status)) { 01255 goto SrvSetConsoleCPFailure; 01256 } 01257 } 01258 01259 if (!IsValidCodePage(a->wCodePageID)) { 01260 Status = STATUS_INVALID_PARAMETER; 01261 goto SrvSetConsoleCPFailure; 01262 } 01263 if ( IsAvailableFarEastCodePage( a->wCodePageID ) && 01264 OEMCP != a->wCodePageID ) 01265 { 01266 Status = STATUS_INVALID_PARAMETER; 01267 goto SrvSetConsoleCPFailure; 01268 } 01269 01270 if ( (a->Output && Console->OutputCP != a->wCodePageID) || 01271 (!a->Output && Console->CP != a->wCodePageID) ) { 01272 01273 UINT CodePage; 01274 01275 if (a->Output) { 01276 01277 // Backup old code page 01278 CodePage = Console->OutputCP; 01279 01280 // Set new code page 01281 Console->OutputCP = a->wCodePageID; 01282 01283 Console->fIsDBCSOutputCP = CONSOLE_IS_DBCS_ENABLED() && IsAvailableFarEastCodePage(Console->OutputCP); 01284 01285 if (!ReCreateDbcsScreenBuffer(Console, CodePage) ) { 01286 RIPMSG1(RIP_WARNING, "SrvSetConsoleCP: ReCreateDbcsScreenBuffer failed. Restoring to CP=%d", 01287 CodePage); 01288 Console->OutputCP = CodePage; 01289 Console->fIsDBCSOutputCP = CONSOLE_IS_DBCS_ENABLED() && IsAvailableFarEastCodePage(CodePage); 01290 Status = STATUS_NO_MEMORY; 01291 goto SrvSetConsoleCPFailure; 01292 } 01293 SetConsoleCPInfo(Console,a->Output); 01294 Status = QueueConsoleMessage(Console, 01295 CM_SET_IME_CODEPAGE, 01296 (WPARAM)hEvent, 01297 MAKELPARAM(a->Output,CodePage) 01298 ); 01299 if (!NT_SUCCESS(Status)) { 01300 goto SrvSetConsoleCPFailure; 01301 } 01302 01303 // load special ROM font, if necessary 01304 01305 #ifdef i386 01306 01307 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 01308 SetROMFontCodePage(Console->OutputCP, 01309 Console->CurrentScreenBuffer->BufferInfo.TextInfo.ModeIndex); 01310 WriteRegionToScreenHW(Console->CurrentScreenBuffer, 01311 &Console->CurrentScreenBuffer->Window); 01312 } 01313 #endif 01314 01315 01316 } else { 01317 01318 // Backup old code page 01319 CodePage = Console->CP; 01320 01321 // Set new code page 01322 Console->CP = a->wCodePageID; 01323 01324 Console->fIsDBCSCP = CONSOLE_IS_DBCS_ENABLED() && IsAvailableFarEastCodePage(Console->CP); 01325 01326 SetConsoleCPInfo(Console,a->Output); 01327 Status = QueueConsoleMessage(Console, 01328 CM_SET_IME_CODEPAGE, 01329 (WPARAM)hEvent, 01330 MAKELPARAM(a->Output,CodePage) 01331 ); 01332 if (!NT_SUCCESS(Status)) { 01333 goto SrvSetConsoleCPFailure; 01334 } 01335 } 01336 } 01337 else { 01338 if (hEvent) { 01339 NtSetEvent(hEvent, NULL); 01340 NtClose(hEvent); 01341 } 01342 } 01343 01344 UnlockConsole(Console); 01345 return STATUS_SUCCESS; 01346 01347 SrvSetConsoleCPFailure: 01348 if (hEvent) { 01349 NtSetEvent(hEvent, NULL); 01350 NtClose(hEvent); 01351 } 01352 UnlockConsole(Console); 01353 return Status; 01354 01355 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01356 }

ULONG SrvSetConsoleCursor IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 213 of file server/private.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETCURSOR_MSG::ConsoleHandle, _CONSOLE_SETCURSOR_MSG::CursorHandle, DereferenceIoHandle(), ghNormalCursor, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_SETCURSOR_MSG::OutputHandle, PostMessage(), Status, and UnlockConsole().

00220 : 00221 00222 Sets the mouse pointer for the specified screen buffer. 00223 00224 Parameters: 00225 00226 hConsoleOutput - Supplies a console output handle. 00227 00228 hCursor - win32 cursor handle, should be NULL to set the default 00229 cursor. 00230 00231 Return value: 00232 00233 TRUE - The operation was successful. 00234 00235 FALSE/NULL - The operation failed. Extended error status is available 00236 using GetLastError. 00237 00238 --*/ 00239 00240 { 00241 PCONSOLE_SETCURSOR_MSG a = (PCONSOLE_SETCURSOR_MSG)&m->u.ApiMessageData; 00242 NTSTATUS Status; 00243 PCONSOLE_INFORMATION Console; 00244 PHANDLE_DATA HandleData; 00245 00246 Status = ApiPreamble(a->ConsoleHandle, 00247 &Console 00248 ); 00249 if (!NT_SUCCESS(Status)) { 00250 return Status; 00251 } 00252 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00253 a->OutputHandle, 00254 CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00255 GENERIC_WRITE, 00256 &HandleData 00257 ); 00258 if (NT_SUCCESS(Status)) { 00259 if (a->CursorHandle == NULL) { 00260 HandleData->Buffer.ScreenBuffer->CursorHandle = ghNormalCursor; 00261 } else { 00262 HandleData->Buffer.ScreenBuffer->CursorHandle = a->CursorHandle; 00263 } 00264 PostMessage(HandleData->Buffer.ScreenBuffer->Console->hWnd, 00265 WM_SETCURSOR, 00266 0, 00267 -1 00268 ); 00269 } 00270 UnlockConsole(Console); 00271 return Status; 00272 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00273 }

ULONG SrvSetConsoleCursorInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 738 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETCURSORINFO_MSG::ConsoleHandle, _CONSOLE_SETCURSORINFO_MSG::CursorSize, DereferenceIoHandle(), NT_SUCCESS, NTSTATUS(), _CONSOLE_SETCURSORINFO_MSG::OutputHandle, SetCursorInformation(), Status, UnlockConsole(), and _CONSOLE_SETCURSORINFO_MSG::Visible.

00742 { 00743 PCONSOLE_SETCURSORINFO_MSG a = (PCONSOLE_SETCURSORINFO_MSG)&m->u.ApiMessageData; 00744 NTSTATUS Status; 00745 PCONSOLE_INFORMATION Console; 00746 PHANDLE_DATA HandleData; 00747 00748 Status = ApiPreamble(a->ConsoleHandle, 00749 &Console 00750 ); 00751 if (!NT_SUCCESS(Status)) { 00752 return Status; 00753 } 00754 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00755 a->OutputHandle, 00756 CONSOLE_OUTPUT_HANDLE, 00757 GENERIC_WRITE, 00758 &HandleData 00759 ); 00760 if (NT_SUCCESS(Status)) { 00761 if (a->CursorSize > 100 || a->CursorSize == 0) { 00762 Status = STATUS_INVALID_PARAMETER; 00763 } else { 00764 Status = SetCursorInformation(HandleData->Buffer.ScreenBuffer,a->CursorSize,a->Visible); 00765 } 00766 } 00767 UnlockConsole(Console); 00768 return((ULONG) Status); 00769 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00770 }

ULONG SrvSetConsoleCursorPosition IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 662 of file ntcon/server/getset.c.

References AdjustCursorPosition, ApiPreamble(), _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::Console, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETCURSORPOSITION_MSG::ConsoleHandle, _CONSOLE_SETCURSORPOSITION_MSG::CursorPosition, DereferenceIoHandle(), FALSE, _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::InputBuffer, NT_SUCCESS, NTSTATUS(), _CONSOLE_SETCURSORPOSITION_MSG::OutputHandle, _SCREEN_INFORMATION::ScreenBufferSize, SetCursorPosition(), SetWindowOrigin(), SHORT, Status, TRUE, UnlockConsole(), and _SCREEN_INFORMATION::Window.

00666 { 00667 PCONSOLE_SETCURSORPOSITION_MSG a = (PCONSOLE_SETCURSORPOSITION_MSG)&m->u.ApiMessageData; 00668 NTSTATUS Status; 00669 PCONSOLE_INFORMATION Console; 00670 PHANDLE_DATA HandleData; 00671 COORD WindowOrigin; 00672 PSCREEN_INFORMATION ScreenInfo; 00673 00674 Status = ApiPreamble(a->ConsoleHandle, 00675 &Console 00676 ); 00677 if (!NT_SUCCESS(Status)) { 00678 return Status; 00679 } 00680 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00681 a->OutputHandle, 00682 CONSOLE_OUTPUT_HANDLE, 00683 GENERIC_WRITE, 00684 &HandleData 00685 ); 00686 if (NT_SUCCESS(Status)) { 00687 00688 ScreenInfo = HandleData->Buffer.ScreenBuffer; 00689 00690 if (a->CursorPosition.X >= ScreenInfo->ScreenBufferSize.X || 00691 a->CursorPosition.Y >= ScreenInfo->ScreenBufferSize.Y || 00692 a->CursorPosition.X < 0 || 00693 a->CursorPosition.Y < 0) { 00694 Status = STATUS_INVALID_PARAMETER; 00695 } else { 00696 Status = SetCursorPosition(ScreenInfo, 00697 a->CursorPosition, 00698 TRUE 00699 ); 00700 } 00701 if (NT_SUCCESS(Status)) { 00702 #if defined(FE_IME) 00703 if (ScreenInfo->Console->Flags & CONSOLE_JUST_VDM_UNREGISTERED){ 00704 if( ScreenInfo->Console->InputBuffer.ImeMode.Open ){ 00705 SHORT ScrollY = 0; 00706 AdjustCursorPosition(ScreenInfo,a->CursorPosition,TRUE,&ScrollY); 00707 a->CursorPosition.Y += ScrollY; 00708 } 00709 Console->Flags &= ~CONSOLE_JUST_VDM_UNREGISTERED; 00710 } 00711 #endif 00712 WindowOrigin.X = 0; 00713 WindowOrigin.Y = 0; 00714 if (ScreenInfo->Window.Left > a->CursorPosition.X) { 00715 WindowOrigin.X = a->CursorPosition.X - ScreenInfo->Window.Left; 00716 } 00717 else if (ScreenInfo->Window.Right < a->CursorPosition.X) { 00718 WindowOrigin.X = a->CursorPosition.X - ScreenInfo->Window.Right; 00719 } 00720 if (ScreenInfo->Window.Top > a->CursorPosition.Y) { 00721 WindowOrigin.Y = a->CursorPosition.Y - ScreenInfo->Window.Top; 00722 } 00723 else if (ScreenInfo->Window.Bottom < a->CursorPosition.Y) { 00724 WindowOrigin.Y = a->CursorPosition.Y - ScreenInfo->Window.Bottom; 00725 } 00726 Status = SetWindowOrigin(ScreenInfo, 00727 FALSE, 00728 WindowOrigin 00729 ); 00730 } 00731 } 00732 UnlockConsole(Console); 00733 return((ULONG) Status); 00734 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00735 }

ULONG SrvSetConsoleDisplayMode IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 853 of file server/private.c.

References ACTIVE_SCREEN_BUFFER, ApiPreamble(), ASSERT, _HANDLE_DATA::Buffer, CM_MODE_TRANSITION, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_TEXTMODE_BUFFER, _CONSOLE_SETDISPLAYMODE_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_SETDISPLAYMODE_MSG::dwFlags, FALSE, _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, FullScreenInitialized, _CONSOLE_SETDISPLAYMODE_MSG::hEvent, NT_SUCCESS, NtClose(), NtDuplicateObject(), NtSetEvent(), NTSTATUS(), NULL, _CONSOLE_SETDISPLAYMODE_MSG::OutputHandle, QueueConsoleMessage(), Status, UINT, and UnlockConsole().

00860 : 00861 00862 This routine sets the console display mode for an output buffer. 00863 This API is only supported on x86 machines. Jazz consoles are always 00864 windowed. 00865 00866 Parameters: 00867 00868 hConsoleOutput - Supplies a console output handle. 00869 00870 dwFlags - Specifies the display mode. Options are: 00871 00872 CONSOLE_FULLSCREEN_MODE - data is displayed fullscreen 00873 00874 CONSOLE_WINDOWED_MODE - data is displayed in a window 00875 00876 lpNewScreenBufferDimensions - On output, contains the new dimensions of 00877 the screen buffer. The dimensions are in rows and columns for 00878 textmode screen buffers. 00879 00880 Return value: 00881 00882 TRUE - The operation was successful. 00883 00884 FALSE/NULL - The operation failed. Extended error status is available 00885 using GetLastError. 00886 00887 --*/ 00888 00889 { 00890 PCONSOLE_SETDISPLAYMODE_MSG a = (PCONSOLE_SETDISPLAYMODE_MSG)&m->u.ApiMessageData; 00891 NTSTATUS Status; 00892 PCONSOLE_INFORMATION Console; 00893 PHANDLE_DATA HandleData; 00894 PSCREEN_INFORMATION ScreenInfo; 00895 UINT State; 00896 HANDLE hEvent = NULL; 00897 00898 Status = ApiPreamble(a->ConsoleHandle, 00899 &Console 00900 ); 00901 if (!NT_SUCCESS(Status)) { 00902 return Status; 00903 } 00904 00905 Status = NtDuplicateObject(CONSOLE_CLIENTPROCESSHANDLE(), 00906 a->hEvent, 00907 NtCurrentProcess(), 00908 &hEvent, 00909 0, 00910 FALSE, 00911 DUPLICATE_SAME_ACCESS 00912 ); 00913 if (!NT_SUCCESS(Status)) { 00914 goto SrvSetConsoleDisplayModeFailure; 00915 } 00916 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00917 a->OutputHandle, 00918 CONSOLE_OUTPUT_HANDLE | CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00919 GENERIC_WRITE, 00920 &HandleData 00921 ); 00922 if (NT_SUCCESS(Status)) { 00923 ScreenInfo = HandleData->Buffer.ScreenBuffer; 00924 if (!ACTIVE_SCREEN_BUFFER(ScreenInfo)) { 00925 Status = STATUS_INVALID_PARAMETER; 00926 goto SrvSetConsoleDisplayModeFailure; 00927 } 00928 if (a->dwFlags == CONSOLE_FULLSCREEN_MODE) { 00929 #if !defined(_X86_) 00930 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00931 Status = STATUS_INVALID_PARAMETER; 00932 goto SrvSetConsoleDisplayModeFailure; 00933 } 00934 #else 00935 if (!FullScreenInitialized) { 00936 Status = STATUS_INVALID_PARAMETER; 00937 goto SrvSetConsoleDisplayModeFailure; 00938 } 00939 #endif 00940 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00941 KdPrint(("CONSRV: VDM converting to fullscreen twice\n")); 00942 ASSERT(FALSE); 00943 Status = STATUS_INVALID_PARAMETER; 00944 goto SrvSetConsoleDisplayModeFailure; 00945 } 00946 State = FULLSCREEN; 00947 } else { 00948 if (Console->FullScreenFlags == 0) { 00949 KdPrint(("CONSRV: VDM converting to windowed twice\n")); 00950 ASSERT(FALSE); 00951 Status = STATUS_INVALID_PARAMETER; 00952 goto SrvSetConsoleDisplayModeFailure; 00953 } 00954 State = WINDOWED; 00955 } 00956 Status = QueueConsoleMessage(Console, 00957 CM_MODE_TRANSITION, 00958 State, 00959 (LPARAM)hEvent 00960 ); 00961 if (!NT_SUCCESS(Status)) { 00962 goto SrvSetConsoleDisplayModeFailure; 00963 } 00964 } 00965 UnlockConsole(Console); 00966 return Status; 00967 00968 SrvSetConsoleDisplayModeFailure: 00969 if (hEvent) { 00970 NtSetEvent(hEvent, NULL); 00971 NtClose(hEvent); 00972 } 00973 UnlockConsole(Console); 00974 return Status; 00975 00976 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00977 }

ULONG SrvSetConsoleFont IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1118 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::Console, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETFONT_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_SETFONT_MSG::FontIndex, _CONSOLE_INFORMATION::FullScreenFlags, NT_SUCCESS, NTSTATUS(), _CONSOLE_INFORMATION::OutputCP, _CONSOLE_SETFONT_MSG::OutputHandle, SetScreenBufferFont(), Status, and UnlockConsole().

01122 { 01123 PCONSOLE_SETFONT_MSG a = (PCONSOLE_SETFONT_MSG)&m->u.ApiMessageData; 01124 NTSTATUS Status; 01125 PCONSOLE_INFORMATION Console; 01126 PHANDLE_DATA HandleData; 01127 PSCREEN_INFORMATION ScreenInfo; 01128 01129 Status = ApiPreamble(a->ConsoleHandle, 01130 &Console 01131 ); 01132 if (!NT_SUCCESS(Status)) { 01133 return Status; 01134 } 01135 try { 01136 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01137 a->OutputHandle, 01138 CONSOLE_OUTPUT_HANDLE, 01139 GENERIC_WRITE, 01140 &HandleData 01141 ); 01142 if (!NT_SUCCESS(Status)) { 01143 leave; 01144 } 01145 01146 ScreenInfo = HandleData->Buffer.ScreenBuffer; 01147 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 01148 Status = STATUS_FULLSCREEN_MODE; 01149 } else { 01150 #if defined(FE_SB) 01151 Status = SetScreenBufferFont(ScreenInfo,a->FontIndex,ScreenInfo->Console->OutputCP); 01152 #else 01153 Status = SetScreenBufferFont(ScreenInfo,a->FontIndex); 01154 #endif 01155 } 01156 } finally { 01157 UnlockConsole(Console); 01158 } 01159 return Status; 01160 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01161 }

ULONG SrvSetConsoleHardwareState IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2280 of file server/private.c.

References ApiPreamble(), BOOL, _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::BufferInfo, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETHARDWARESTATE_MSG::ConsoleHandle, DereferenceIoHandle(), FALSE, _CONSOLE_SETHARDWARESTATE_MSG::FontSize, _MODE_FONT_PAIR::FontSize, FS_GRAPHICS, FS_TEXT, _CONSOLE_INFORMATION::FullScreenFlags, Index, IsAvailableFsCodePage(), _MODE_FONT_PAIR::Mode, ModeFontPairs, NT_SUCCESS, NTSTATUS(), NUMBER_OF_MODE_FONT_PAIRS, _CONSOLE_INFORMATION::OutputCP, _CONSOLE_SETHARDWARESTATE_MSG::OutputHandle, RegModeFontPairs, _CONSOLE_SETHARDWARESTATE_MSG::Resolution, _MODE_FONT_PAIR::Resolution, Status, and UnlockConsole().

02284 { 02285 #ifdef i386 02286 PCONSOLE_SETHARDWARESTATE_MSG a = (PCONSOLE_SETHARDWARESTATE_MSG)&m->u.ApiMessageData; 02287 NTSTATUS Status; 02288 PCONSOLE_INFORMATION Console; 02289 PHANDLE_DATA HandleData; 02290 PSCREEN_INFORMATION ScreenInfo; 02291 ULONG Index; 02292 02293 Status = ApiPreamble(a->ConsoleHandle, 02294 &Console 02295 ); 02296 if (!NT_SUCCESS(Status)) { 02297 return Status; 02298 } 02299 if (!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)) { 02300 UnlockConsole(Console); 02301 return (ULONG)STATUS_UNSUCCESSFUL; 02302 } 02303 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 02304 a->OutputHandle, 02305 CONSOLE_OUTPUT_HANDLE, 02306 GENERIC_READ, 02307 &HandleData 02308 ); 02309 if (NT_SUCCESS(Status)) { 02310 #if defined(FE_SB) 02311 BOOL fGraphics = fFullScreenGraphics ? IsAvailableFsCodePage(Console->OutputCP) : FALSE; 02312 #endif 02313 ScreenInfo = HandleData->Buffer.ScreenBuffer; 02314 02315 // match requested mode 02316 02317 for (Index=0;Index<NUMBER_OF_MODE_FONT_PAIRS;Index++) { 02318 #if defined(FE_SB) 02319 if (a->Resolution.X == RegModeFontPairs[Index].Resolution.X && 02320 a->Resolution.Y == RegModeFontPairs[Index].Resolution.Y && 02321 a->FontSize.Y == RegModeFontPairs[Index].FontSize.Y && 02322 a->FontSize.X == RegModeFontPairs[Index].FontSize.X && 02323 ( ( fGraphics && (RegModeFontPairs[Index].Mode & FS_GRAPHICS)==FS_GRAPHICS) || 02324 (!fGraphics && (RegModeFontPairs[Index].Mode & FS_TEXT)==FS_TEXT) ) 02325 ) { 02326 break; 02327 } 02328 #else 02329 if (a->Resolution.X == ModeFontPairs[Index].Resolution.X && 02330 a->Resolution.Y == ModeFontPairs[Index].Resolution.Y && 02331 a->FontSize.Y == ModeFontPairs[Index].FontSize.Y && 02332 a->FontSize.X == ModeFontPairs[Index].FontSize.X) { 02333 break; 02334 } 02335 #endif 02336 } 02337 if (Index == NUMBER_OF_MODE_FONT_PAIRS) { 02338 Status = STATUS_INVALID_PARAMETER; 02339 } else { 02340 // set requested mode 02341 ScreenInfo->BufferInfo.TextInfo.ModeIndex = Index; 02342 SetVideoMode(ScreenInfo); 02343 } 02344 } 02345 UnlockConsole(Console); 02346 return Status; 02347 #else 02348 return (ULONG)STATUS_UNSUCCESSFUL; 02349 UNREFERENCED_PARAMETER(m); // get rid of unreferenced parameter warning message 02350 #endif 02351 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02352 }

ULONG SrvSetConsoleIcon IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1164 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_SETICON_MSG::ConsoleHandle, CopyIcon(), DestroyIcon, ghDefaultIcon, ghDefaultSmIcon, _CONSOLE_SETICON_MSG::hIcon, _CONSOLE_INFORMATION::hIcon, _CONSOLE_INFORMATION::hSmIcon, _CONSOLE_INFORMATION::hWnd, NT_SUCCESS, NTSTATUS(), NULL, PostMessage(), Status, and UnlockConsole().

01168 { 01169 PCONSOLE_SETICON_MSG a = (PCONSOLE_SETICON_MSG)&m->u.ApiMessageData; 01170 NTSTATUS Status; 01171 PCONSOLE_INFORMATION Console; 01172 HANDLE hIcon; 01173 01174 Status = ApiPreamble(a->ConsoleHandle, 01175 &Console 01176 ); 01177 if (!NT_SUCCESS(Status)) { 01178 return Status; 01179 } 01180 01181 if (a->hIcon == NULL) { 01182 hIcon = ghDefaultIcon; 01183 } else { 01184 hIcon = CopyIcon(a->hIcon); 01185 } 01186 01187 if (hIcon == NULL) { 01188 Status = STATUS_INVALID_PARAMETER; 01189 } else if (hIcon != Console->hIcon) { 01190 PostMessage(Console->hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); 01191 if (Console->hIcon != ghDefaultIcon) { 01192 DestroyIcon(Console->hIcon); 01193 } 01194 Console->hIcon = hIcon; 01195 01196 /* 01197 * Small icon now 01198 */ 01199 if (hIcon != ghDefaultIcon) { 01200 /* 01201 * The new one is not the default, clean-up 01202 */ 01203 if (Console->hSmIcon != NULL && Console->hSmIcon != ghDefaultSmIcon) { 01204 DestroyIcon(Console->hSmIcon); 01205 } 01206 Console->hSmIcon = NULL; 01207 PostMessage(Console->hWnd, WM_SETICON, ICON_SMALL, (LPARAM)NULL); 01208 } else { 01209 /* 01210 * Change to default, so we can use the default small icon 01211 */ 01212 if (Console->hSmIcon != ghDefaultSmIcon) { 01213 if (Console->hSmIcon != NULL) { 01214 DestroyIcon(Console->hSmIcon); 01215 } 01216 Console->hSmIcon = ghDefaultSmIcon; 01217 PostMessage(Console->hWnd, WM_SETICON, ICON_SMALL, (LPARAM)ghDefaultSmIcon); 01218 } 01219 } 01220 } 01221 UnlockConsole(Console); 01222 01223 return Status; 01224 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01225 }

ULONG SrvSetConsoleKeyShortcuts IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2423 of file server/private.c.

References ApiPreamble(), _CONSOLE_SETKEYSHORTCUTS_MSG::AppKeys, CONSOLE_HAS_FOCUS, CONSOLE_MAX_APP_SHORTCUTS, _CONSOLE_SETKEYSHORTCUTS_MSG::ConsoleHandle, ConvertHotKey(), _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::hWnd, NT_SUCCESS, NTSTATUS(), _CONSOLE_SETKEYSHORTCUTS_MSG::NumAppKeys, PostMessage(), _CONSOLE_INFORMATION::ReserveKeys, _CONSOLE_SETKEYSHORTCUTS_MSG::ReserveKeys, SetConsoleReserveKeys(), Status, and UnlockConsole().

02427 { 02428 PCONSOLE_SETKEYSHORTCUTS_MSG a = (PCONSOLE_SETKEYSHORTCUTS_MSG)&m->u.ApiMessageData; 02429 NTSTATUS Status; 02430 PCONSOLE_INFORMATION Console; 02431 02432 Status = ApiPreamble(a->ConsoleHandle, 02433 &Console 02434 ); 02435 if (!NT_SUCCESS(Status)) { 02436 return Status; 02437 } 02438 02439 if (!CsrValidateMessageBuffer(m, &a->AppKeys, a->NumAppKeys, sizeof(*a->AppKeys))) { 02440 UnlockConsole(Console); 02441 return STATUS_INVALID_PARAMETER; 02442 } 02443 02444 if (a->NumAppKeys <= CONSOLE_MAX_APP_SHORTCUTS) { 02445 Console->ReserveKeys = a->ReserveKeys; 02446 if (Console->Flags & CONSOLE_HAS_FOCUS) { 02447 if (!(SetConsoleReserveKeys(Console->hWnd,a->ReserveKeys))) { 02448 Status = STATUS_INVALID_PARAMETER; 02449 } 02450 } 02451 if (a->NumAppKeys) { 02452 PostMessage(Console->hWnd, 02453 WM_SETHOTKEY, 02454 ConvertHotKey(a->AppKeys), 02455 0 02456 ); 02457 } 02458 } else { 02459 Status = STATUS_INVALID_PARAMETER; 02460 } 02461 UnlockConsole(Console); 02462 return Status; 02463 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02464 }

ULONG SrvSetConsoleMenuClose IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2376 of file server/private.c.

References ApiPreamble(), CONSOLE_DISABLE_CLOSE, _CONSOLE_SETMENUCLOSE_MSG::ConsoleHandle, _CONSOLE_SETMENUCLOSE_MSG::Enable, _CONSOLE_INFORMATION::Flags, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

02380 { 02381 PCONSOLE_SETMENUCLOSE_MSG a = (PCONSOLE_SETMENUCLOSE_MSG)&m->u.ApiMessageData; 02382 NTSTATUS Status; 02383 PCONSOLE_INFORMATION Console; 02384 02385 Status = ApiPreamble(a->ConsoleHandle, 02386 &Console 02387 ); 02388 if (!NT_SUCCESS(Status)) { 02389 return Status; 02390 } 02391 if (a->Enable) { 02392 Console->Flags &= ~CONSOLE_DISABLE_CLOSE; 02393 } else { 02394 Console->Flags |= CONSOLE_DISABLE_CLOSE; 02395 } 02396 UnlockConsole(Console); 02397 return Status; 02398 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02399 }

ULONG SrvSetConsoleMode IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 354 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_ANY_HANDLE, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_QUICK_EDIT_MODE, CONSOLE_TEXTMODE_BUFFER, CONSOLE_USE_PRIVATE_FLAGS, _CONSOLE_MODE_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandle(), FALSE, _CONSOLE_INFORMATION::Flags, _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, _CONSOLE_MODE_MSG::Handle, _HANDLE_DATA::HandleType, INPUT_MODES, _CONSOLE_INFORMATION::InsertMode, _CONSOLE_MODE_MSG::Mode, NT_SUCCESS, NTSTATUS(), OUTPUT_MODES, _CONSOLE_INFORMATION::OutputCP, PRIVATE_MODES, Status, TRUE, UnlockConsole(), and _SCREEN_INFORMATION::Window.

00358 { 00359 PCONSOLE_MODE_MSG a = (PCONSOLE_MODE_MSG)&m->u.ApiMessageData; 00360 NTSTATUS Status; 00361 PCONSOLE_INFORMATION Console; 00362 PHANDLE_DATA HandleData; 00363 00364 Status = ApiPreamble(a->ConsoleHandle, 00365 &Console 00366 ); 00367 if (!NT_SUCCESS(Status)) { 00368 return Status; 00369 } 00370 try { 00371 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00372 a->Handle, 00373 CONSOLE_ANY_HANDLE, 00374 GENERIC_WRITE, 00375 &HandleData 00376 ); 00377 if (!NT_SUCCESS(Status)) { 00378 leave; 00379 } 00380 00381 if (HandleData->HandleType & CONSOLE_INPUT_HANDLE) { 00382 if (a->Mode & ~(INPUT_MODES | PRIVATE_MODES)) { 00383 Status = STATUS_INVALID_PARAMETER; 00384 leave; 00385 } 00386 if ((a->Mode & (ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT)) == ENABLE_ECHO_INPUT) { 00387 Status = STATUS_INVALID_PARAMETER; 00388 leave; 00389 } 00390 if (a->Mode & PRIVATE_MODES) { 00391 Console->Flags |= CONSOLE_USE_PRIVATE_FLAGS; 00392 if (a->Mode & ENABLE_QUICK_EDIT_MODE) { 00393 Console->Flags |= CONSOLE_QUICK_EDIT_MODE; 00394 } else { 00395 Console->Flags &= ~CONSOLE_QUICK_EDIT_MODE; 00396 } 00397 if (a->Mode & ENABLE_INSERT_MODE) { 00398 Console->InsertMode = TRUE; 00399 } else { 00400 Console->InsertMode = FALSE; 00401 } 00402 } else { 00403 Console->Flags &= ~CONSOLE_USE_PRIVATE_FLAGS; 00404 } 00405 00406 #ifdef i386 00407 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE && 00408 Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER && 00409 (a->Mode & ENABLE_MOUSE_INPUT) != (HandleData->Buffer.InputBuffer->InputMode & ENABLE_MOUSE_INPUT)) { 00410 if (a->Mode & ENABLE_MOUSE_INPUT) { 00411 HandleData->Buffer.InputBuffer->InputMode |= ENABLE_MOUSE_INPUT; 00412 } 00413 #if defined(FE_SB) 00414 // Korean HBIOS doesn't like to reverse mouse pointer. 00415 // Because HBIOS will initialize full screen mode again. 00416 // 949 = Korea WanSung Code Page. 00417 if (Console->OutputCP != 949) { 00418 ReverseMousePointer(Console->CurrentScreenBuffer, 00419 &Console->CurrentScreenBuffer->Window); 00420 } 00421 #else 00422 ReverseMousePointer(Console->CurrentScreenBuffer, 00423 &Console->CurrentScreenBuffer->Window); 00424 #endif 00425 } 00426 #endif 00427 HandleData->Buffer.InputBuffer->InputMode = a->Mode & ~PRIVATE_MODES; 00428 } 00429 else { 00430 if (a->Mode & ~OUTPUT_MODES) { 00431 Status = STATUS_INVALID_PARAMETER; 00432 leave; 00433 } 00434 HandleData->Buffer.ScreenBuffer->OutputMode = a->Mode; 00435 } 00436 } finally { 00437 UnlockConsole(Console); 00438 } 00439 return Status; 00440 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00441 }

DWORD SrvSetConsoleNumberOfCommands IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1424 of file server/cmdline.c.

References ApiPreamble(), BYTE, _CONSOLE_SETNUMBEROFCOMMANDS_MSG::ConsoleHandle, _CONSOLE_SETNUMBEROFCOMMANDS_MSG::Exe, _CONSOLE_SETNUMBEROFCOMMANDS_MSG::ExeLength, FindExeCommandHistory(), NT_SUCCESS, NTSTATUS(), _CONSOLE_SETNUMBEROFCOMMANDS_MSG::NumCommands, ReallocCommandHistory(), Status, _CONSOLE_SETNUMBEROFCOMMANDS_MSG::UnicodeExe, and UnlockConsole().

01428 { 01429 PCONSOLE_SETNUMBEROFCOMMANDS_MSG a = (PCONSOLE_SETNUMBEROFCOMMANDS_MSG)&m->u.ApiMessageData; 01430 PCONSOLE_INFORMATION Console; 01431 NTSTATUS Status; 01432 01433 Status = ApiPreamble(a->ConsoleHandle, 01434 &Console 01435 ); 01436 if (!NT_SUCCESS(Status)) { 01437 return Status; 01438 } 01439 01440 if (!CsrValidateMessageBuffer(m, &a->Exe, a->ExeLength, sizeof(BYTE))) { 01441 UnlockConsole(Console); 01442 return STATUS_INVALID_PARAMETER; 01443 } 01444 01445 ReallocCommandHistory(Console, 01446 FindExeCommandHistory(Console, 01447 a->Exe, 01448 a->ExeLength, 01449 a->UnicodeExe), 01450 a->NumCommands 01451 ); 01452 UnlockConsole(Console); 01453 return STATUS_SUCCESS; 01454 UNREFERENCED_PARAMETER(ReplyStatus); 01455 }

ULONG SrvSetConsolePalette IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 432 of file server/private.c.

References ApiPreamble(), BOOL, _HANDLE_DATA::Buffer, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_IS_ICONIC, CONSOLE_PERPROCESSDATA, _CONSOLE_SETPALETTE_MSG::ConsoleHandle, DereferenceIoHandle(), _CONSOLE_SETPALETTE_MSG::dwUsage, FALSE, _CONSOLE_SETPALETTE_MSG::hPalette, _CONSOLE_INFORMATION::InputThreadInfo, NT_SUCCESS, NTSTATUS(), NtUserConsoleControl(), NtUserSetInformationThread(), NULL, _CONSOLE_SETPALETTE_MSG::OutputHandle, RealizePalette, SelectPalette, Status, _INPUT_THREAD_INFO::ThreadId, TRUE, and UnlockConsole().

00439 : 00440 00441 Sets the palette for the console screen buffer. 00442 00443 Parameters: 00444 00445 hOutput - Supplies a console output handle. 00446 00447 hPalette - Supplies a handle to the palette to set. 00448 00449 dwUsage - Specifies use of the system palette. 00450 00451 SYSPAL_NOSTATIC - System palette contains no static colors 00452 except black and white. 00453 00454 SYSPAL_STATIC - System palette contains static colors 00455 which will not change when an application 00456 realizes its logical palette. 00457 00458 Return value: 00459 00460 TRUE - The operation was successful. 00461 00462 FALSE/NULL - The operation failed. Extended error status is available 00463 using GetLastError. 00464 00465 --*/ 00466 00467 { 00468 PCONSOLE_SETPALETTE_MSG a = (PCONSOLE_SETPALETTE_MSG)&m->u.ApiMessageData; 00469 NTSTATUS Status; 00470 PCONSOLE_INFORMATION Console; 00471 PHANDLE_DATA HandleData; 00472 HPALETTE hOldPalette; 00473 00474 Status = ApiPreamble(a->ConsoleHandle, 00475 &Console 00476 ); 00477 if (!NT_SUCCESS(Status)) { 00478 return Status; 00479 } 00480 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00481 a->OutputHandle, 00482 CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00483 GENERIC_WRITE, 00484 &HandleData 00485 ); 00486 if (NT_SUCCESS(Status)) { 00487 USERTHREAD_USEDESKTOPINFO utudi; 00488 BOOL bReset = FALSE; 00489 00490 /* 00491 * Palette handle was converted in the client. 00492 */ 00493 if (GetCurrentThreadId() != HandleData->Buffer.ScreenBuffer-> 00494 Console->InputThreadInfo->ThreadId) { 00495 bReset = TRUE; 00496 utudi.hThread = HandleData->Buffer.ScreenBuffer->Console->InputThreadInfo->ThreadHandle; 00497 utudi.drdRestore.pdeskRestore = NULL; 00498 NtUserSetInformationThread(NtCurrentThread(), 00499 UserThreadUseDesktop, 00500 &utudi, sizeof(utudi)); 00501 } 00502 00503 NtUserConsoleControl(ConsolePublicPalette, &(a->hPalette), sizeof(HPALETTE)); 00504 00505 hOldPalette = SelectPalette( 00506 HandleData->Buffer.ScreenBuffer->Console->hDC, 00507 a->hPalette, 00508 FALSE); 00509 00510 if (hOldPalette == NULL) { 00511 Status = STATUS_INVALID_PARAMETER; 00512 } else { 00513 if ((HandleData->Buffer.ScreenBuffer->hPalette != NULL) && 00514 (a->hPalette != HandleData->Buffer.ScreenBuffer->hPalette)) { 00515 DeleteObject(HandleData->Buffer.ScreenBuffer->hPalette); 00516 } 00517 HandleData->Buffer.ScreenBuffer->hPalette = a->hPalette; 00518 HandleData->Buffer.ScreenBuffer->dwUsage = a->dwUsage; 00519 if (!(HandleData->Buffer.ScreenBuffer->Console->Flags & CONSOLE_IS_ICONIC) && 00520 HandleData->Buffer.ScreenBuffer->Console->FullScreenFlags == 0) { 00521 00522 SetSystemPaletteUse(HandleData->Buffer.ScreenBuffer->Console->hDC, 00523 HandleData->Buffer.ScreenBuffer->dwUsage); 00524 RealizePalette(HandleData->Buffer.ScreenBuffer->Console->hDC); 00525 } 00526 if (HandleData->Buffer.ScreenBuffer->Console->hSysPalette == NULL) { 00527 HandleData->Buffer.ScreenBuffer->Console->hSysPalette = hOldPalette; 00528 } 00529 } 00530 00531 if (bReset) { 00532 utudi.hThread = NULL; 00533 NtUserSetInformationThread(NtCurrentThread(), 00534 UserThreadUseDesktop, &utudi, sizeof(utudi)); 00535 } 00536 } 00537 UnlockConsole(Console); 00538 return Status; 00539 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00540 }

ULONG SrvSetConsoleScreenBufferSize IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 608 of file ntcon/server/getset.c.

References ApiPreamble(), _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, _CONSOLE_SETSCREENBUFFERSIZE_MSG::ConsoleHandle, DereferenceIoHandle(), GetWindowLimits(), _WINDOW_LIMITS::MinimumWindowSize, NT_SUCCESS, NTSTATUS(), _CONSOLE_SETSCREENBUFFERSIZE_MSG::OutputHandle, ResizeScreenBuffer(), _SCREEN_INFORMATION::ScreenBufferSize, _CONSOLE_SETSCREENBUFFERSIZE_MSG::Size, Status, TRUE, and UnlockConsole().

00612 { 00613 PCONSOLE_SETSCREENBUFFERSIZE_MSG a = (PCONSOLE_SETSCREENBUFFERSIZE_MSG)&m->u.ApiMessageData; 00614 NTSTATUS Status; 00615 PCONSOLE_INFORMATION Console; 00616 PHANDLE_DATA HandleData; 00617 PSCREEN_INFORMATION ScreenInfo; 00618 WINDOW_LIMITS WindowLimits; 00619 00620 Status = ApiPreamble(a->ConsoleHandle, 00621 &Console 00622 ); 00623 if (!NT_SUCCESS(Status)) { 00624 return Status; 00625 } 00626 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00627 a->OutputHandle, 00628 CONSOLE_OUTPUT_HANDLE, 00629 GENERIC_WRITE, 00630 &HandleData 00631 ); 00632 if (NT_SUCCESS(Status)) { 00633 00634 ScreenInfo = HandleData->Buffer.ScreenBuffer; 00635 00636 // 00637 // make sure requested screen buffer size isn't smaller than the window 00638 // 00639 00640 GetWindowLimits(ScreenInfo, &WindowLimits); 00641 if (a->Size.X < CONSOLE_WINDOW_SIZE_X(ScreenInfo) || 00642 a->Size.Y < CONSOLE_WINDOW_SIZE_Y(ScreenInfo) || 00643 a->Size.Y < WindowLimits.MinimumWindowSize.Y || 00644 a->Size.X < WindowLimits.MinimumWindowSize.X) { 00645 Status = STATUS_INVALID_PARAMETER; 00646 } 00647 else if (a->Size.X == ScreenInfo->ScreenBufferSize.X && 00648 a->Size.Y == ScreenInfo->ScreenBufferSize.Y) { 00649 Status = STATUS_SUCCESS; 00650 } else { 00651 Status = ResizeScreenBuffer(ScreenInfo, 00652 a->Size, 00653 TRUE); 00654 } 00655 } 00656 UnlockConsole(Console); 00657 return((ULONG) Status); 00658 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00659 }

ULONG SrvSetConsoleTextAttribute IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1078 of file ntcon/server/getset.c.

References ApiPreamble(), _CONSOLE_SETTEXTATTRIBUTE_MSG::Attributes, _HANDLE_DATA::Buffer, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETTEXTATTRIBUTE_MSG::ConsoleHandle, DereferenceIoHandle(), FALSE, NT_SUCCESS, NTSTATUS(), _CONSOLE_SETTEXTATTRIBUTE_MSG::OutputHandle, SetScreenColors(), Status, UnlockConsole(), and VALID_TEXT_ATTRIBUTES.

01082 { 01083 PCONSOLE_SETTEXTATTRIBUTE_MSG a = (PCONSOLE_SETTEXTATTRIBUTE_MSG)&m->u.ApiMessageData; 01084 NTSTATUS Status; 01085 PCONSOLE_INFORMATION Console; 01086 PHANDLE_DATA HandleData; 01087 01088 Status = ApiPreamble(a->ConsoleHandle, 01089 &Console 01090 ); 01091 if (!NT_SUCCESS(Status)) { 01092 return Status; 01093 } 01094 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01095 a->OutputHandle, 01096 CONSOLE_OUTPUT_HANDLE, 01097 GENERIC_WRITE, 01098 &HandleData 01099 ); 01100 if (NT_SUCCESS(Status)) { 01101 01102 if (a->Attributes & ~VALID_TEXT_ATTRIBUTES) { 01103 Status = STATUS_INVALID_PARAMETER; 01104 } else { 01105 Status = SetScreenColors(HandleData->Buffer.ScreenBuffer, 01106 a->Attributes, 01107 HandleData->Buffer.ScreenBuffer->PopupAttributes, 01108 FALSE 01109 ); 01110 } 01111 } 01112 UnlockConsole(Console); 01113 return((ULONG) Status); 01114 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01115 }

ULONG SrvSetConsoleTitle IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 4929 of file server/cmdline.c.

References ApiPreamble(), BYTE, CM_UPDATE_TITLE, _CONSOLE_SETTITLE_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, ConvertInputToUnicode(), _CONSOLE_INFORMATION::CP, _CONSOLE_INFORMATION::hWnd, MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, OEMCP, PostMessage(), Status, _CONSOLE_INFORMATION::Title, _CONSOLE_SETTITLE_MSG::Title, TITLE_TAG, _CONSOLE_INFORMATION::TitleLength, _CONSOLE_SETTITLE_MSG::TitleLength, _CONSOLE_SETTITLE_MSG::Unicode, UnlockConsole(), and USHORT.

04933 { 04934 PCONSOLE_SETTITLE_MSG a = (PCONSOLE_SETTITLE_MSG)&m->u.ApiMessageData; 04935 NTSTATUS Status; 04936 PCONSOLE_INFORMATION Console; 04937 LPWSTR NewTitle; 04938 04939 Status = ApiPreamble(a->ConsoleHandle, 04940 &Console 04941 ); 04942 if (!NT_SUCCESS(Status)) { 04943 return Status; 04944 } 04945 04946 if (!CsrValidateMessageBuffer(m, &a->Title, a->TitleLength, sizeof(BYTE))) { 04947 UnlockConsole(Console); 04948 return STATUS_INVALID_PARAMETER; 04949 } 04950 04951 if (!a->Unicode) { 04952 NewTitle = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TITLE_TAG ),a->TitleLength*sizeof(WCHAR)+sizeof(WCHAR)); 04953 if (NewTitle == NULL) { 04954 UnlockConsole(Console); 04955 return (ULONG)STATUS_NO_MEMORY; 04956 } 04957 04958 // convert title to unicode 04959 04960 #if defined(FE_SB) 04961 Console->TitleLength = (USHORT)ConvertInputToUnicode(OEMCP, 04962 a->Title, 04963 a->TitleLength, 04964 NewTitle, 04965 a->TitleLength); 04966 #else 04967 Console->TitleLength = (USHORT)ConvertInputToUnicode(Console->CP, 04968 a->Title, 04969 a->TitleLength, 04970 NewTitle, 04971 a->TitleLength); 04972 #endif 04973 Console->TitleLength *= 2; 04974 } else { 04975 // a->TitleLength contains length in bytes 04976 04977 NewTitle = (LPWSTR)ConsoleHeapAlloc(MAKE_TAG( TITLE_TAG ),a->TitleLength+sizeof(WCHAR)); 04978 if (NewTitle == NULL) { 04979 UnlockConsole(Console); 04980 return (ULONG)STATUS_NO_MEMORY; 04981 } 04982 Console->TitleLength = (USHORT)a->TitleLength; 04983 RtlCopyMemory(NewTitle,a->Title,a->TitleLength); 04984 } 04985 NewTitle[Console->TitleLength/sizeof(WCHAR)] = 0; // NULL terminate 04986 ConsoleHeapFree(Console->Title); 04987 Console->Title = NewTitle; 04988 PostMessage(Console->hWnd, CM_UPDATE_TITLE, 0, 0); 04989 UnlockConsole(Console); 04990 return STATUS_SUCCESS; 04991 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 04992 }

ULONG SrvSetConsoleWindowInfo IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 773 of file ntcon/server/getset.c.

References _CONSOLE_SETWINDOWINFO_MSG::Absolute, ACTIVE_SCREEN_BUFFER, ApiPreamble(), _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::BufferInfo, _SCREEN_INFORMATION::Console, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, CONSOLE_VDM_REGISTERED, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, _CONSOLE_SETWINDOWINFO_MSG::ConsoleHandle, DereferenceIoHandle(), FALSE, _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, GetWindowLimits(), _WINDOW_LIMITS::MaximumWindowSize, NT_SUCCESS, NTSTATUS(), _CONSOLE_INFORMATION::OutputCP, _CONSOLE_SETWINDOWINFO_MSG::OutputHandle, ResizeWindow(), _SCREEN_INFORMATION::ScreenBufferSize, SetWindowOrigin(), SetWindowSize(), SHORT, Status, TRUE, UnlockConsole(), _CONSOLE_SETWINDOWINFO_MSG::Window, _SCREEN_INFORMATION::Window, WINDOW_SIZE_X, WINDOW_SIZE_Y, and WriteToScreen.

00777 { 00778 PCONSOLE_SETWINDOWINFO_MSG a = (PCONSOLE_SETWINDOWINFO_MSG)&m->u.ApiMessageData; 00779 NTSTATUS Status; 00780 PCONSOLE_INFORMATION Console; 00781 PHANDLE_DATA HandleData; 00782 PSCREEN_INFORMATION ScreenInfo; 00783 COORD NewWindowSize; 00784 WINDOW_LIMITS WindowLimits; 00785 00786 Status = ApiPreamble(a->ConsoleHandle, 00787 &Console 00788 ); 00789 if (!NT_SUCCESS(Status)) { 00790 return Status; 00791 } 00792 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00793 a->OutputHandle, 00794 CONSOLE_OUTPUT_HANDLE, 00795 GENERIC_WRITE, 00796 &HandleData 00797 ); 00798 if (NT_SUCCESS(Status)) { 00799 ScreenInfo = HandleData->Buffer.ScreenBuffer; 00800 if (!a->Absolute) { 00801 a->Window.Left += ScreenInfo->Window.Left; 00802 a->Window.Right += ScreenInfo->Window.Right; 00803 a->Window.Top += ScreenInfo->Window.Top; 00804 a->Window.Bottom += ScreenInfo->Window.Bottom; 00805 } 00806 if (a->Window.Right < a->Window.Left || 00807 a->Window.Bottom < a->Window.Top) { 00808 Status = STATUS_INVALID_PARAMETER; 00809 } else { 00810 NewWindowSize.X = (SHORT)(WINDOW_SIZE_X(&a->Window)); 00811 NewWindowSize.Y = (SHORT)(WINDOW_SIZE_Y(&a->Window)); 00812 GetWindowLimits(ScreenInfo, &WindowLimits); 00813 if ((NewWindowSize.X > WindowLimits.MaximumWindowSize.X || 00814 NewWindowSize.Y > WindowLimits.MaximumWindowSize.Y) && 00815 !(ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 00816 Status = STATUS_INVALID_PARAMETER; 00817 } else { 00818 #ifdef i386 00819 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00820 COORD NewOrigin; 00821 00822 if (NewWindowSize.X != (SHORT)(WINDOW_SIZE_X(&ScreenInfo->Window)) || 00823 NewWindowSize.Y != (SHORT)(WINDOW_SIZE_Y(&ScreenInfo->Window))) { 00824 COORD WindowSize; 00825 ULONG ModeIndex; 00826 00827 #if defined(FE_SB) 00828 ModeIndex = MatchWindowSize(ScreenInfo->Console->OutputCP,NewWindowSize,&WindowSize); 00829 #else 00830 ModeIndex = MatchWindowSize(NewWindowSize,&WindowSize); 00831 #endif 00832 if (NewWindowSize.X != WindowSize.X || 00833 NewWindowSize.Y != WindowSize.Y || 00834 WindowSize.X > ScreenInfo->ScreenBufferSize.X || 00835 WindowSize.Y > ScreenInfo->ScreenBufferSize.Y) { 00836 UnlockConsole(Console); 00837 return (ULONG) STATUS_FULLSCREEN_MODE; 00838 } 00839 ScreenInfo->BufferInfo.TextInfo.ModeIndex = ModeIndex; 00840 ResizeWindow(ScreenInfo, 00841 &a->Window, 00842 FALSE 00843 ); 00844 ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.X = 00845 CONSOLE_WINDOW_SIZE_X(ScreenInfo); 00846 ScreenInfo->BufferInfo.TextInfo.WindowedWindowSize.Y = 00847 CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 00848 if (ScreenInfo->Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE && 00849 (!(ScreenInfo->Console->Flags & CONSOLE_VDM_REGISTERED)) ) { 00850 SetVideoMode(ScreenInfo); 00851 WriteToScreen(ScreenInfo,&ScreenInfo->Window); 00852 } 00853 } else { 00854 NewOrigin.X = a->Window.Left; 00855 NewOrigin.Y = a->Window.Top; 00856 SetWindowOrigin(ScreenInfo, 00857 TRUE, 00858 NewOrigin 00859 ); 00860 } 00861 } else 00862 #endif 00863 { 00864 Status = ResizeWindow(ScreenInfo, 00865 &a->Window, 00866 TRUE 00867 ); 00868 if (ACTIVE_SCREEN_BUFFER(ScreenInfo)) { 00869 SetWindowSize(ScreenInfo); 00870 WriteToScreen(ScreenInfo,&ScreenInfo->Window); 00871 } 00872 } 00873 } 00874 } 00875 } 00876 UnlockConsole(Console); 00877 return((ULONG) Status); 00878 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00879 }

ULONG SrvSetHandleInformation IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2794 of file server/stream.c.

References ApiPreamble(), CONSOLE_INHERITABLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SETHANDLEINFORMATION_MSG::ConsoleHandle, DereferenceIoHandleNoCheck(), _CONSOLE_SETHANDLEINFORMATION_MSG::Flags, _CONSOLE_SETHANDLEINFORMATION_MSG::Handle, HANDLE_TO_INDEX, _HANDLE_DATA::HandleType, _CONSOLE_SETHANDLEINFORMATION_MSG::Mask, NT_SUCCESS, NTSTATUS(), Status, and UnlockConsole().

02801 : 02802 02803 This sets information about an input or output handle. 02804 02805 Arguments: 02806 02807 ApiMessageData - Points to parameter structure. 02808 02809 Return Value: 02810 02811 --*/ 02812 02813 { 02814 PCONSOLE_SETHANDLEINFORMATION_MSG a = (PCONSOLE_SETHANDLEINFORMATION_MSG)&m->u.ApiMessageData; 02815 PCONSOLE_INFORMATION Console; 02816 PHANDLE_DATA HandleData; 02817 NTSTATUS Status; 02818 02819 Status = ApiPreamble(a->ConsoleHandle, 02820 &Console 02821 ); 02822 if (!NT_SUCCESS(Status)) { 02823 return Status; 02824 } 02825 Status = DereferenceIoHandleNoCheck(CONSOLE_PERPROCESSDATA(), 02826 HANDLE_TO_INDEX(a->Handle), 02827 &HandleData 02828 ); 02829 if (NT_SUCCESS(Status)) { 02830 if (a->Mask & HANDLE_FLAG_INHERIT) { 02831 if (a->Flags & HANDLE_FLAG_INHERIT) { 02832 HandleData->HandleType |= CONSOLE_INHERITABLE; 02833 } else { 02834 HandleData->HandleType &= ~CONSOLE_INHERITABLE; 02835 } 02836 } 02837 } 02838 UnlockConsole(Console); 02839 return Status; 02840 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 02841 }

ULONG SrvShowConsoleCursor IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 298 of file server/private.c.

References ApiPreamble(), _CONSOLE_SHOWCURSOR_MSG::bShow, _HANDLE_DATA::Buffer, CONSOLE_GRAPHICS_OUTPUT_HANDLE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_SHOWCURSOR_MSG::ConsoleHandle, _CONSOLE_INFORMATION::CurrentScreenBuffer, DereferenceIoHandle(), _CONSOLE_SHOWCURSOR_MSG::DisplayCount, _CONSOLE_INFORMATION::FullScreenFlags, _HANDLE_DATA::HandleType, NT_SUCCESS, NTSTATUS(), _CONSOLE_SHOWCURSOR_MSG::OutputHandle, PostMessage(), Status, and UnlockConsole().

00305 : 00306 00307 Sets the mouse pointer visibility counter. If the counter is less than 00308 zero, the mouse pointer is not shown. 00309 00310 Parameters: 00311 00312 hOutput - Supplies a console output handle. 00313 00314 bShow - if TRUE, the display count is to be increased. if FALSE, 00315 decreased. 00316 00317 Return value: 00318 00319 The return value specifies the new display count. 00320 00321 --*/ 00322 00323 { 00324 PCONSOLE_SHOWCURSOR_MSG a = (PCONSOLE_SHOWCURSOR_MSG)&m->u.ApiMessageData; 00325 NTSTATUS Status; 00326 PCONSOLE_INFORMATION Console; 00327 PHANDLE_DATA HandleData; 00328 00329 Status = ApiPreamble(a->ConsoleHandle, 00330 &Console 00331 ); 00332 if (!NT_SUCCESS(Status)) { 00333 return Status; 00334 } 00335 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00336 a->OutputHandle, 00337 CONSOLE_OUTPUT_HANDLE | CONSOLE_GRAPHICS_OUTPUT_HANDLE, 00338 GENERIC_WRITE, 00339 &HandleData 00340 ); 00341 if (NT_SUCCESS(Status)) { 00342 if (!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) ) { 00343 if (a->bShow) { 00344 HandleData->Buffer.ScreenBuffer->CursorDisplayCount += 1; 00345 } else { 00346 HandleData->Buffer.ScreenBuffer->CursorDisplayCount -= 1; 00347 } 00348 if (HandleData->Buffer.ScreenBuffer == Console->CurrentScreenBuffer) { 00349 PostMessage(HandleData->Buffer.ScreenBuffer->Console->hWnd, 00350 WM_SETCURSOR, 00351 0, 00352 -1 00353 ); 00354 } 00355 } else { 00356 #ifdef i386 00357 if (HandleData->HandleType != CONSOLE_GRAPHICS_OUTPUT_HANDLE && 00358 Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE && 00359 HandleData->Buffer.ScreenBuffer == Console->CurrentScreenBuffer) { 00360 FullScreenCursor(HandleData->Buffer.ScreenBuffer,a->bShow); 00361 } 00362 #endif 00363 } 00364 a->DisplayCount = HandleData->Buffer.ScreenBuffer->CursorDisplayCount; 00365 } 00366 UnlockConsole(Console); 00367 return Status; 00368 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00369 }

ULONG SrvVDMConsoleOperation IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 24 of file srvvdm.c.

References ApiPreamble(), ASSERT, _CONSOLE_VDM_MSG::Bool, BYTE, ClientToScreen(), CM_HIDE_WINDOW, CONSOLE_CLIENTPROCESSID, CONSOLE_FULLSCREEN_NOPAINT, CONSOLE_NO_WINDOW, CONSOLE_VDM_REGISTERED, _CONSOLE_VDM_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, DWORD, FALSE, _CONSOLE_INFORMATION::Flags, GetClientRect(), _CONSOLE_INFORMATION::hWnd, _CONSOLE_VDM_MSG::iFunction, IsIconic(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, PCONSOLE_VDM_MSG, _CONSOLE_VDM_MSG::Point, PostMessage(), _CONSOLE_VDM_MSG::Rect, ScreenToClient(), _CONSOLE_INFORMATION::StateBuffer, _CONSOLE_INFORMATION::StateLength, Status, UnlockConsole(), and _CONSOLE_INFORMATION::VDMProcessId.

00028 { 00029 PCONSOLE_VDM_MSG a = (PCONSOLE_VDM_MSG)&m->u.ApiMessageData; 00030 NTSTATUS Status; 00031 PCONSOLE_INFORMATION Console; 00032 00033 Status = ApiPreamble(a->ConsoleHandle, 00034 &Console 00035 ); 00036 if (!NT_SUCCESS(Status)) { 00037 return Status; 00038 } 00039 if (!(Console->Flags & CONSOLE_VDM_REGISTERED) || 00040 (Console->VDMProcessId != CONSOLE_CLIENTPROCESSID())) { 00041 Status = STATUS_INVALID_PARAMETER; 00042 } else { 00043 switch (a->iFunction) { 00044 case VDM_HIDE_WINDOW: 00045 PostMessage(Console->hWnd, 00046 CM_HIDE_WINDOW, 00047 0, 00048 0 00049 ); 00050 break; 00051 case VDM_IS_ICONIC: 00052 a->Bool = IsIconic(Console->hWnd); 00053 break; 00054 case VDM_CLIENT_RECT: 00055 GetClientRect(Console->hWnd,&a->Rect); 00056 break; 00057 case VDM_CLIENT_TO_SCREEN: 00058 ClientToScreen(Console->hWnd,&a->Point); 00059 break; 00060 case VDM_SCREEN_TO_CLIENT: 00061 ScreenToClient(Console->hWnd,&a->Point); 00062 break; 00063 case VDM_IS_HIDDEN: 00064 a->Bool = ((Console->Flags & CONSOLE_NO_WINDOW) != 0); 00065 break; 00066 case VDM_FULLSCREEN_NOPAINT: 00067 if (a->Bool) { 00068 Console->Flags |= CONSOLE_FULLSCREEN_NOPAINT; 00069 } else { 00070 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 00071 } 00072 break; 00073 #if defined(FE_SB) 00074 case VDM_SET_VIDEO_MODE: 00075 Console->fVDMVideoMode = (a->Bool != 0); 00076 break; 00077 #if defined(i386) 00078 case VDM_SAVE_RESTORE_HW_STATE: 00079 if (ISNECPC98(gdwMachineId)) { 00080 // This function is used by MVDM to save/restore HW state 00081 // when it executes DOS-AP on Fullscreen again. 00082 // It is called from MVDM\SOFTPC\HOST\SRC\NT_FULSC.C. 00083 VIDEO_HARDWARE_STATE State; 00084 ULONG StateSize = sizeof(State); 00085 00086 State.StateHeader = Console->StateBuffer; 00087 State.StateLength = Console->StateLength; 00088 00089 00090 Status = GdiFullscreenControl(a->Bool ? FullscreenControlRestoreHardwareState 00091 : FullscreenControlSaveHardwareState, 00092 &State, 00093 StateSize, 00094 &State, 00095 &StateSize); 00096 } 00097 break; 00098 case VDM_VIDEO_IOCTL: 00099 if (ISNECPC98(gdwMachineId)) { 00100 // This function is used by MVDM to access CG. 00101 // It is called from MVDM\SOFTPC\HOST\SRC\NT_CGW.C. 00102 PVOID InBuffer; 00103 00104 if (!CsrValidateMessageBuffer(m, &a->VDMIoctlParam.lpvInBuffer, a->VDMIoctlParam.cbInBuffer, sizeof(BYTE)) || 00105 !CsrValidateMessageBuffer(m, &a->VDMIoctlParam.lpvOutBuffer, a->VDMIoctlParam.cbOutBuffer, sizeof(BYTE))) { 00106 UnlockConsole(Console); 00107 return STATUS_INVALID_PARAMETER; 00108 } 00109 00110 InBuffer = ConsoleHeapAlloc( 00111 MAKE_TAG( TMP_DBCS_TAG ), 00112 a->VDMIoctlParam.cbInBuffer + sizeof(DWORD) 00113 ); 00114 if (InBuffer == NULL) 00115 { 00116 Status = STATUS_NO_MEMORY; 00117 break; 00118 } 00119 00120 *((PDWORD)InBuffer) = a->VDMIoctlParam.dwIoControlCode; 00121 RtlCopyMemory((PBYTE)InBuffer + sizeof(DWORD), 00122 a->VDMIoctlParam.lpvInBuffer, 00123 a->VDMIoctlParam.cbInBuffer 00124 ); 00125 00126 Status = GdiFullscreenControl( 00127 FullscreenControlSpecificVideoControl, 00128 InBuffer, 00129 ConsoleHeapSize(InBuffer), 00130 a->VDMIoctlParam.lpvOutBuffer, 00131 a->VDMIoctlParam.lpvOutBuffer ? 00132 &a->VDMIoctlParam.cbOutBuffer : 0 00133 ); 00134 00135 ConsoleHeapFree(InBuffer); 00136 } 00137 break; 00138 #endif 00139 #endif 00140 default: 00141 ASSERT(FALSE); 00142 } 00143 } 00144 00145 UnlockConsole(Console); 00146 return Status; 00147 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00148 }

ULONG SrvVerifyConsoleIoHandle IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1582 of file w32/ntcon/server/handle.c.

References ApiPreamble(), CONSOLE_PERPROCESSDATA, _CONSOLE_VERIFYIOHANDLE_MSG::ConsoleHandle, DereferenceIoHandleNoCheck(), _CONSOLE_VERIFYIOHANDLE_MSG::Handle, HANDLE_TO_INDEX, NT_SUCCESS, NTSTATUS(), Status, UnlockConsole(), and _CONSOLE_VERIFYIOHANDLE_MSG::Valid.

01589 : 01590 01591 This routine verifies that a console io handle is valid. 01592 01593 Arguments: 01594 01595 ApiMessageData - Points to parameter structure. 01596 01597 Return Value: 01598 01599 --*/ 01600 01601 { 01602 PCONSOLE_VERIFYIOHANDLE_MSG a = (PCONSOLE_VERIFYIOHANDLE_MSG)&m->u.ApiMessageData; 01603 PCONSOLE_INFORMATION Console; 01604 NTSTATUS Status; 01605 PHANDLE_DATA HandleData; 01606 PCONSOLE_PER_PROCESS_DATA ProcessData; 01607 01608 UNREFERENCED_PARAMETER(ReplyStatus); 01609 01610 Status = ApiPreamble(a->ConsoleHandle, 01611 &Console 01612 ); 01613 if (NT_SUCCESS(Status)) { 01614 ProcessData = CONSOLE_PERPROCESSDATA(); 01615 Status = DereferenceIoHandleNoCheck(ProcessData, 01616 HANDLE_TO_INDEX(a->Handle), 01617 &HandleData 01618 ); 01619 UnlockConsole(Console); 01620 } 01621 a->Valid = (NT_SUCCESS(Status)); 01622 return STATUS_SUCCESS; 01623 }

ULONG SrvWriteConsole IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 2463 of file server/stream.c.

References ApiPreamble(), _CONSOLE_WRITECONSOLE_MSG::Buffer, _CONSOLE_WRITECONSOLE_MSG::BufferInMessage, _CONSOLE_WRITECONSOLE_MSG::BufPtr, BYTE, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_WRITECONSOLE_MSG::ConsoleHandle, DereferenceIoHandle(), DoSrvWriteConsole, NT_SUCCESS, NTSTATUS(), _CONSOLE_WRITECONSOLE_MSG::NumBytes, _CONSOLE_WRITECONSOLE_MSG::OutputHandle, Status, and UnlockConsole().

02470 : 02471 02472 This routine writes characters to the output stream. 02473 02474 Arguments: 02475 02476 ApiMessageData - Points to parameter structure. 02477 02478 Return Value: 02479 02480 --*/ 02481 02482 { 02483 NTSTATUS Status; 02484 PCONSOLE_WRITECONSOLE_MSG a = (PCONSOLE_WRITECONSOLE_MSG)&m->u.ApiMessageData; 02485 PCONSOLE_INFORMATION Console; 02486 PHANDLE_DATA HandleData; 02487 02488 Status = ApiPreamble(a->ConsoleHandle, 02489 &Console 02490 ); 02491 if (!NT_SUCCESS(Status)) { 02492 return Status; 02493 } 02494 02495 if (!a->BufferInMessage) { 02496 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumBytes, sizeof(BYTE))) { 02497 UnlockConsole(Console); 02498 return STATUS_INVALID_PARAMETER; 02499 } 02500 } 02501 else if (a->NumBytes > sizeof(a->Buffer)) { 02502 UnlockConsole(Console); 02503 return STATUS_INVALID_PARAMETER; 02504 } 02505 02506 02507 // 02508 // Make sure we have a valid screen buffer. 02509 // 02510 02511 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 02512 a->OutputHandle, 02513 CONSOLE_OUTPUT_HANDLE, 02514 GENERIC_WRITE, 02515 &HandleData 02516 ); 02517 if (!NT_SUCCESS(Status)) { 02518 UnlockConsole(Console); 02519 return Status; 02520 } 02521 02522 Status = DoSrvWriteConsole(m,ReplyStatus,Console,HandleData); 02523 02524 UnlockConsole(Console); 02525 return Status; 02526 }

ULONG SrvWriteConsoleInput IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 730 of file directio.c.

References ApiPreamble(), _CONSOLE_WRITECONSOLEINPUT_MSG::Append, Buffer, _HANDLE_DATA::Buffer, _CONSOLE_WRITECONSOLEINPUT_MSG::BufPtr, CONSOLE_INPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_WRITECONSOLEINPUT_MSG::ConsoleHandle, DereferenceIoHandle(), INPUT_RECORD_BUFFER_SIZE, _CONSOLE_WRITECONSOLEINPUT_MSG::InputHandle, NT_SUCCESS, NTSTATUS(), _CONSOLE_WRITECONSOLEINPUT_MSG::NumRecords, PrependInputBuffer(), _CONSOLE_WRITECONSOLEINPUT_MSG::Record, Status, TranslateInputToUnicode(), _CONSOLE_WRITECONSOLEINPUT_MSG::Unicode, UnlockConsole(), and WriteInputBuffer().

00734 { 00735 PCONSOLE_WRITECONSOLEINPUT_MSG a = (PCONSOLE_WRITECONSOLEINPUT_MSG)&m->u.ApiMessageData; 00736 PCONSOLE_INFORMATION Console; 00737 PHANDLE_DATA HandleData; 00738 NTSTATUS Status; 00739 PINPUT_RECORD Buffer; 00740 00741 Status = ApiPreamble(a->ConsoleHandle, 00742 &Console 00743 ); 00744 if (!NT_SUCCESS(Status)) { 00745 return Status; 00746 } 00747 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 00748 a->InputHandle, 00749 CONSOLE_INPUT_HANDLE, 00750 GENERIC_WRITE, 00751 &HandleData 00752 ); 00753 if (!NT_SUCCESS(Status)) { 00754 a->NumRecords = 0; 00755 } else { 00756 if (a->NumRecords <= INPUT_RECORD_BUFFER_SIZE) { 00757 Buffer = a->Record; 00758 } else { 00759 Buffer = a->BufPtr; 00760 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumRecords, sizeof(*Buffer))) { 00761 UnlockConsole(Console); 00762 return STATUS_INVALID_PARAMETER; 00763 } 00764 } 00765 if (!a->Unicode) { 00766 #if defined(FE_SB) 00767 a->NumRecords = TranslateInputToUnicode(Console, 00768 Buffer, 00769 a->NumRecords, 00770 &HandleData->Buffer.InputBuffer->WriteConInpDbcsLeadByte[0] 00771 ); 00772 #else 00773 TranslateInputToUnicode(Console, 00774 Buffer, 00775 a->NumRecords 00776 ); 00777 #endif 00778 } 00779 if (a->Append) { 00780 a->NumRecords = WriteInputBuffer(Console, 00781 HandleData->Buffer.InputBuffer, 00782 Buffer, 00783 a->NumRecords 00784 ); 00785 } else { 00786 a->NumRecords = PrependInputBuffer(Console, 00787 HandleData->Buffer.InputBuffer, 00788 Buffer, 00789 a->NumRecords 00790 ); 00791 00792 } 00793 } 00794 UnlockConsole(Console); 00795 return((ULONG) Status); 00796 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 00797 }

ULONG SrvWriteConsoleOutput IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1284 of file directio.c.

References ApiPreamble(), Buffer, _HANDLE_DATA::Buffer, _SCREEN_INFORMATION::BufferInfo, BufferSize, _CONSOLE_WRITECONSOLEOUTPUT_MSG::BufPtr, BYTE, _CONSOLE_WRITECONSOLEOUTPUT_MSG::Char, _CONSOLE_WRITECONSOLEOUTPUT_MSG::CharRegion, CONSOLE_CLIENTPROCESSHANDLE, CONSOLE_OEMFONT_DISPLAY, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_WRITECONSOLEOUTPUT_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, _CONSOLE_INFORMATION::CurrentScreenBuffer, DBGOUTPUT, DereferenceIoHandle(), FE_TranslateOutputToAnsiUnicode(), _SCREEN_INFORMATION::Flags, _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, _CONSOLE_INFORMATION::InputBuffer, _INPUT_INFORMATION::InputMode, MAKE_TAG, NT_SUCCESS, NtReadVirtualMemory(), NTSTATUS(), NULL, _CONSOLE_WRITECONSOLEOUTPUT_MSG::OutputHandle, _CONSOLE_WRITECONSOLEOUTPUT_MSG::ReadVM, SB_TranslateOutputToAnsiUnicode(), SHORT, Status, TEXT_VALID_HINT, TMP_TAG, TranslateOutputToAnsiUnicode(), TranslateOutputToUnicode, _CONSOLE_WRITECONSOLEOUTPUT_MSG::Unicode, UnlockConsole(), USHORT, WriteScreenBuffer(), and WriteToScreen.

01288 { 01289 PCONSOLE_WRITECONSOLEOUTPUT_MSG a = (PCONSOLE_WRITECONSOLEOUTPUT_MSG)&m->u.ApiMessageData; 01290 PSCREEN_INFORMATION ScreenBufferInformation; 01291 PCONSOLE_INFORMATION Console; 01292 PHANDLE_DATA HandleData; 01293 NTSTATUS Status; 01294 PCHAR_INFO Buffer; 01295 #if defined(FE_SB) 01296 PCHAR_INFO TransBuffer = NULL; 01297 #endif 01298 01299 DBGOUTPUT(("SrvWriteConsoleOutput\n")); 01300 Status = ApiPreamble(a->ConsoleHandle, 01301 &Console 01302 ); 01303 if (!NT_SUCCESS(Status)) { 01304 return Status; 01305 } 01306 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01307 a->OutputHandle, 01308 CONSOLE_OUTPUT_HANDLE, 01309 GENERIC_WRITE, 01310 &HandleData 01311 ); 01312 if (!NT_SUCCESS(Status)) { 01313 01314 // 01315 // a region of zero size is indicated by the right and bottom 01316 // coordinates being less than the left and top. 01317 // 01318 01319 a->CharRegion.Right = (USHORT) (a->CharRegion.Left-1); 01320 a->CharRegion.Bottom = (USHORT) (a->CharRegion.Top-1); 01321 } else { 01322 01323 COORD BufferSize; 01324 ULONG NumBytes; 01325 01326 BufferSize.X = (SHORT)(a->CharRegion.Right - a->CharRegion.Left + 1); 01327 BufferSize.Y = (SHORT)(a->CharRegion.Bottom - a->CharRegion.Top + 1); 01328 NumBytes = BufferSize.X * BufferSize.Y * sizeof(*Buffer); 01329 01330 if ((BufferSize.X == 1) && (BufferSize.Y == 1)) { 01331 Buffer = &a->Char; 01332 } else if (a->ReadVM) { 01333 Buffer = ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),NumBytes); 01334 if (Buffer == NULL) { 01335 UnlockConsole(Console); 01336 return (ULONG)STATUS_NO_MEMORY; 01337 } 01338 Status = NtReadVirtualMemory(CONSOLE_CLIENTPROCESSHANDLE(), 01339 a->BufPtr, 01340 Buffer, 01341 NumBytes, 01342 NULL 01343 ); 01344 if (!NT_SUCCESS(Status)) { 01345 ConsoleHeapFree(Buffer); 01346 UnlockConsole(Console); 01347 return (ULONG)STATUS_NO_MEMORY; 01348 } 01349 } else { 01350 Buffer = a->BufPtr; 01351 if (!CsrValidateMessageBuffer(m, &a->BufPtr, NumBytes, sizeof(BYTE))) { 01352 UnlockConsole(Console); 01353 return STATUS_INVALID_PARAMETER; 01354 } 01355 } 01356 ScreenBufferInformation = HandleData->Buffer.ScreenBuffer; 01357 01358 if (!a->Unicode) { 01359 TranslateOutputToUnicode(Console, 01360 Buffer, 01361 BufferSize 01362 ); 01363 #if defined(FE_SB) 01364 Status = WriteScreenBuffer(ScreenBufferInformation, 01365 Buffer, 01366 &a->CharRegion 01367 ); 01368 #endif 01369 } else if ((Console->CurrentScreenBuffer->Flags & CONSOLE_OEMFONT_DISPLAY) && 01370 ((Console->FullScreenFlags & CONSOLE_FULLSCREEN) == 0)) { 01371 #if defined(FE_SB) 01372 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 01373 TransBuffer = (PCHAR_INFO)ConsoleHeapAlloc(MAKE_TAG( TMP_DBCS_TAG ),(BufferSize.Y * BufferSize.X) * 2 * sizeof(CHAR_INFO)); 01374 if (TransBuffer == NULL) { 01375 UnlockConsole(Console); 01376 return (ULONG)STATUS_NO_MEMORY; 01377 } 01378 FE_TranslateOutputToAnsiUnicode(Console, 01379 Buffer, 01380 BufferSize, 01381 &TransBuffer[0] 01382 ); 01383 Status = WriteScreenBuffer(ScreenBufferInformation, 01384 &TransBuffer[0], 01385 &a->CharRegion 01386 ); 01387 ConsoleHeapFree(TransBuffer); 01388 } 01389 else { 01390 SB_TranslateOutputToAnsiUnicode(Console, 01391 Buffer, 01392 BufferSize 01393 ); 01394 Status = WriteScreenBuffer(ScreenBufferInformation, 01395 Buffer, 01396 &a->CharRegion 01397 ); 01398 } 01399 #else 01400 TranslateOutputToAnsiUnicode(Console, 01401 Buffer, 01402 BufferSize 01403 ); 01404 #endif 01405 } 01406 #if defined(FE_SB) 01407 else 01408 #endif 01409 Status = WriteScreenBuffer(ScreenBufferInformation, 01410 Buffer, 01411 &a->CharRegion 01412 ); 01413 01414 if (a->ReadVM) { 01415 ConsoleHeapFree(Buffer); 01416 } 01417 if (NT_SUCCESS(Status)) { 01418 01419 // 01420 // cause screen to be updated 01421 // 01422 01423 #if defined(FE_SB) 01424 if (CONSOLE_IS_DBCS_OUTPUTCP(Console) && 01425 Console->Flags & CONSOLE_JUST_VDM_UNREGISTERED ){ 01426 int MouseRec; 01427 MouseRec = Console->InputBuffer.InputMode; 01428 Console->InputBuffer.InputMode &= ~ENABLE_MOUSE_INPUT; 01429 Console->CurrentScreenBuffer->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 01430 WriteToScreen(ScreenBufferInformation,&a->CharRegion ); 01431 Console->CurrentScreenBuffer->BufferInfo.TextInfo.Flags |= TEXT_VALID_HINT; 01432 Console->InputBuffer.InputMode = MouseRec; 01433 } 01434 else 01435 #endif 01436 WriteToScreen(ScreenBufferInformation, 01437 &a->CharRegion 01438 ); 01439 } 01440 } 01441 UnlockConsole(Console); 01442 return Status; 01443 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01444 }

ULONG SrvWriteConsoleOutputString IN OUT PCSR_API_MSG  m,
IN OUT PCSR_REPLY_STATUS  ReplyStatus
 

Definition at line 1508 of file directio.c.

References ApiPreamble(), Buffer, _HANDLE_DATA::Buffer, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::BufPtr, CHAR, CONSOLE_ASCII, CONSOLE_OUTPUT_HANDLE, CONSOLE_PERPROCESSDATA, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::ConsoleHandle, DereferenceIoHandle(), NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::NumRecords, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::OutputHandle, Status, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::String, _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::StringType, UnlockConsole(), _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG::WriteCoord, and WriteOutputString.

01512 { 01513 PCONSOLE_WRITECONSOLEOUTPUTSTRING_MSG a = (PCONSOLE_WRITECONSOLEOUTPUTSTRING_MSG)&m->u.ApiMessageData; 01514 NTSTATUS Status; 01515 PCONSOLE_INFORMATION Console; 01516 PHANDLE_DATA HandleData; 01517 PVOID Buffer; 01518 ULONG nSize; 01519 01520 Status = ApiPreamble(a->ConsoleHandle, 01521 &Console 01522 ); 01523 if (!NT_SUCCESS(Status)) { 01524 return Status; 01525 } 01526 Status = DereferenceIoHandle(CONSOLE_PERPROCESSDATA(), 01527 a->OutputHandle, 01528 CONSOLE_OUTPUT_HANDLE, 01529 GENERIC_WRITE, 01530 &HandleData 01531 ); 01532 if (!NT_SUCCESS(Status)) { 01533 a->NumRecords = 0; 01534 } else { 01535 if (a->WriteCoord.X < 0 || 01536 a->WriteCoord.Y < 0) { 01537 Status = STATUS_INVALID_PARAMETER; 01538 } else { 01539 if (a->StringType == CONSOLE_ASCII) 01540 nSize = sizeof(CHAR); 01541 else 01542 nSize = sizeof(WORD); 01543 if ((a->NumRecords*nSize) > sizeof(a->String)) { 01544 Buffer = a->BufPtr; 01545 if (!CsrValidateMessageBuffer(m, &a->BufPtr, a->NumRecords, nSize)) { 01546 UnlockConsole(Console); 01547 return STATUS_INVALID_PARAMETER; 01548 } 01549 } 01550 else { 01551 Buffer = a->String; 01552 } 01553 Status = WriteOutputString(HandleData->Buffer.ScreenBuffer, 01554 Buffer, 01555 a->WriteCoord, 01556 a->StringType, 01557 &a->NumRecords, 01558 NULL 01559 ); 01560 } 01561 } 01562 UnlockConsole(Console); 01563 return Status; 01564 UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message 01565 }

VOID StoreKeyInfo IN PMSG  msg  ) 
 

Definition at line 1587 of file ntcon/server/input.c.

References BYTE, CONSOLE_FREE_KEY_INFO, CONSOLE_MAX_KEY_INFO, ConsoleKeyInfo, _CONSOLE_KEY_INFO::hWnd, msg, _CONSOLE_KEY_INFO::wVirtualKeyCode, and _CONSOLE_KEY_INFO::wVirtualScanCode.

Referenced by ConsoleInputThread(), and DialogHookProc().

01590 { 01591 int i; 01592 01593 for (i=0;i<CONSOLE_MAX_KEY_INFO;i++) { 01594 if (ConsoleKeyInfo[i].hWnd == CONSOLE_FREE_KEY_INFO || 01595 ConsoleKeyInfo[i].hWnd == msg->hwnd) { 01596 break; 01597 } 01598 } 01599 if (i!=CONSOLE_MAX_KEY_INFO) { 01600 ConsoleKeyInfo[i].hWnd = msg->hwnd; 01601 ConsoleKeyInfo[i].wVirtualKeyCode = LOWORD(msg->wParam); 01602 ConsoleKeyInfo[i].wVirtualScanCode = (BYTE)(HIWORD(msg->lParam)); 01603 } else { 01604 KdPrint(("CONSRV: ConsoleKeyInfo buffer is full\n")); 01605 } 01606 }

VOID StoreSelection IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 452 of file ntcon/server/clipbrd.c.

References BisectClipbrd(), BOOL, _SCREEN_INFORMATION::BufferInfo, CloseClipboard, CONSOLE_OEMFONT_DISPLAY, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_TEXTMODE_BUFFER, CONSOLE_VDM_REGISTERED, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, FALSE, FalseUnicodeToRealUnicode(), _SCREEN_INFORMATION::Flags, GetKeyState(), _SCREEN_INFORMATION::hPalette, KEY_PRESSED, MAKE_TAG, MyInvert(), NtReleaseMutant(), NtWaitForSingleObject(), NULL, OpenClipboard(), ReadRectFromScreenBuffer(), _SCREEN_INFORMATION::ScreenBufferSize, SelectPalette, SetClipboardData(), SHORT, StringLength(), TMP_TAG, UNICODE_CARRIAGERETURN, UNICODE_LINEFEED, UNICODE_SPACE, _SCREEN_INFORMATION::Window, WINDOW_SIZE_X, and WINDOW_SIZE_Y.

Referenced by DoCopy(), and HandleKeyEvent().

00462 { 00463 PCHAR_INFO Selection,CurCharInfo; 00464 COORD SourcePoint; 00465 COORD TargetSize; 00466 SMALL_RECT TargetRect; 00467 PWCHAR CurChar,CharBuf; 00468 HANDLE ClipboardDataHandle; 00469 SHORT i,j; 00470 BOOL Success; 00471 PSCREEN_INFORMATION ScreenInfo; 00472 BOOL bFalseUnicode; 00473 BOOL bMungeData; 00474 #if defined(FE_SB) 00475 COORD TargetSize2; 00476 PWCHAR TmpClipboardData; 00477 SMALL_RECT SmallRect2; 00478 COORD TargetPoint; 00479 SHORT StringLength; 00480 WCHAR wchCARRIAGERETURN; 00481 WCHAR wchLINEFEED; 00482 int iExtra = 0; 00483 int iFeReserve = 1; 00484 #endif 00485 00486 // 00487 // See if there is a selection to get 00488 // 00489 00490 if (!(Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY)) { 00491 return; 00492 } 00493 00494 // 00495 // read selection rectangle. clip it first. 00496 // 00497 00498 ScreenInfo = Console->CurrentScreenBuffer; 00499 if (Console->SelectionRect.Left < 0) { 00500 Console->SelectionRect.Left = 0; 00501 } 00502 if (Console->SelectionRect.Top < 0) { 00503 Console->SelectionRect.Top = 0; 00504 } 00505 if (Console->SelectionRect.Right >= ScreenInfo->ScreenBufferSize.X) { 00506 Console->SelectionRect.Right = (SHORT)(ScreenInfo->ScreenBufferSize.X-1); 00507 } 00508 if (Console->SelectionRect.Bottom >= ScreenInfo->ScreenBufferSize.Y) { 00509 Console->SelectionRect.Bottom = (SHORT)(ScreenInfo->ScreenBufferSize.Y-1); 00510 } 00511 00512 TargetSize.X = WINDOW_SIZE_X(&Console->SelectionRect); 00513 TargetSize.Y = WINDOW_SIZE_Y(&Console->SelectionRect); 00514 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00515 #if defined(FE_SB) 00516 00517 if (CONSOLE_IS_DBCS_CP(Console)) { 00518 iExtra = 4 ; // 4 is for DBCS lead or tail extra 00519 iFeReserve = 2 ; // FE does this for safety 00520 TmpClipboardData = (PWCHAR)ConsoleHeapAlloc(MAKE_TAG( TMP_DBCS_TAG ),(sizeof(WCHAR) * TargetSize.Y * (TargetSize.X + iExtra) + sizeof(WCHAR))); 00521 if (TmpClipboardData == NULL) { 00522 return; 00523 } 00524 } else { 00525 TmpClipboardData = NULL; 00526 } 00527 00528 Selection = (PCHAR_INFO)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),sizeof(CHAR_INFO) * (TargetSize.X + iExtra) * TargetSize.Y * iFeReserve); 00529 if (Selection == NULL) 00530 { 00531 if (TmpClipboardData) 00532 ConsoleHeapFree(TmpClipboardData); 00533 return; 00534 } 00535 #else 00536 Selection = (PCHAR_INFO)ConsoleHeapAlloc(MAKE_TAG( TMP_TAG ),sizeof(CHAR_INFO) * TargetSize.X * TargetSize.Y); 00537 if (Selection == NULL) 00538 return; 00539 #endif 00540 00541 #if defined(FE_SB) 00542 if (!CONSOLE_IS_DBCS_CP(Console)) { 00543 #endif 00544 00545 #ifdef i386 00546 if ((Console->FullScreenFlags & CONSOLE_FULLSCREEN) && 00547 (Console->Flags & CONSOLE_VDM_REGISTERED)) { 00548 ReadRegionFromScreenHW(ScreenInfo, 00549 &Console->SelectionRect, 00550 Selection); 00551 CurCharInfo = Selection; 00552 for (i=0; i<TargetSize.Y; i++) { 00553 for (j=0; j<TargetSize.X; j++,CurCharInfo++) { 00554 CurCharInfo->Char.UnicodeChar = SB_CharToWcharGlyph(Console->OutputCP, CurCharInfo->Char.AsciiChar); 00555 } 00556 } 00557 } else { 00558 #endif 00559 SourcePoint.X = Console->SelectionRect.Left; 00560 SourcePoint.Y = Console->SelectionRect.Top; 00561 TargetRect.Left = TargetRect.Top = 0; 00562 TargetRect.Right = (SHORT)(TargetSize.X-1); 00563 TargetRect.Bottom = (SHORT)(TargetSize.Y-1); 00564 ReadRectFromScreenBuffer(ScreenInfo, 00565 SourcePoint, 00566 Selection, 00567 TargetSize, 00568 &TargetRect); 00569 #ifdef i386 00570 } 00571 #endif 00572 00573 // extra 2 per line is for CRLF, extra 1 is for null 00574 ClipboardDataHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 00575 (TargetSize.Y * (TargetSize.X + 2) + 1) * sizeof(WCHAR)); 00576 if (ClipboardDataHandle == NULL) { 00577 ConsoleHeapFree(Selection); 00578 return; 00579 } 00580 #if defined(FE_SB) 00581 } 00582 #endif 00583 00584 // 00585 // convert to clipboard form 00586 // 00587 00588 #if defined(FE_SB) 00589 if (CONSOLE_IS_DBCS_CP(Console)) { 00590 if ((ScreenInfo->Flags & CONSOLE_OEMFONT_DISPLAY) && 00591 !(Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 00592 /* 00593 * False Unicode is obtained, so we will have to convert it to 00594 * Real Unicode, in which case we can't put CR or LF in now, since 00595 * they will be converted into 0x266A and 0x25d9. Temporarily 00596 * mark the CR/LF positions with 0x0000 instead. 00597 */ 00598 wchCARRIAGERETURN = 0x0000; 00599 wchLINEFEED = 0x0000; 00600 } else { 00601 wchCARRIAGERETURN = UNICODE_CARRIAGERETURN; 00602 wchLINEFEED = UNICODE_LINEFEED; 00603 } 00604 00605 CurChar = TmpClipboardData; 00606 bMungeData = (GetKeyState(VK_SHIFT) & KEY_PRESSED) == 0; 00607 for (i=0;i<TargetSize.Y;i++) { 00608 PWCHAR pwchLineStart = CurChar; 00609 00610 SourcePoint.X = Console->SelectionRect.Left; 00611 SourcePoint.Y = Console->SelectionRect.Top + i; 00612 TargetSize2.X = TargetSize.X; 00613 TargetSize2.Y = 1; 00614 00615 SmallRect2.Left = SourcePoint.X; 00616 SmallRect2.Top = SourcePoint.Y; 00617 SmallRect2.Right = SourcePoint.X + TargetSize2.X - 1; 00618 SmallRect2.Bottom = SourcePoint.Y; 00619 TargetPoint = SourcePoint; 00620 StringLength = TargetSize2.X; 00621 BisectClipbrd(StringLength,TargetPoint,ScreenInfo,&SmallRect2); 00622 00623 SourcePoint.X = SmallRect2.Left; 00624 SourcePoint.Y = SmallRect2.Top; 00625 TargetSize2.X = SmallRect2.Right - SmallRect2.Left + 1; 00626 TargetSize2.Y = 1; 00627 TargetRect.Left = TargetRect.Top = TargetRect.Bottom = 0; 00628 TargetRect.Right = (SHORT)(TargetSize2.X-1); 00629 00630 ReadRectFromScreenBuffer(ScreenInfo, 00631 SourcePoint, 00632 Selection, 00633 TargetSize2, 00634 &TargetRect); 00635 00636 CurCharInfo = Selection; 00637 for (j=0;j<TargetSize2.X;j++,CurCharInfo++) { 00638 if (!(CurCharInfo->Attributes & COMMON_LVB_TRAILING_BYTE)) 00639 *CurChar++ = CurCharInfo->Char.UnicodeChar; 00640 } 00641 // trim trailing spaces 00642 if (bMungeData) { 00643 CurChar--; 00644 while ((CurChar >= pwchLineStart) && (*CurChar == UNICODE_SPACE)) 00645 CurChar--; 00646 CurChar++; 00647 *CurChar++ = wchCARRIAGERETURN; 00648 *CurChar++ = wchLINEFEED; 00649 } 00650 } 00651 } 00652 else { 00653 #endif 00654 CurCharInfo = Selection; 00655 CurChar = CharBuf = GlobalLock(ClipboardDataHandle); 00656 bFalseUnicode = ((ScreenInfo->Flags & CONSOLE_OEMFONT_DISPLAY) && 00657 !(Console->FullScreenFlags & CONSOLE_FULLSCREEN)); 00658 bMungeData = (GetKeyState(VK_SHIFT) & KEY_PRESSED) == 0; 00659 for (i=0;i<TargetSize.Y;i++) { 00660 PWCHAR pwchLineStart = CurChar; 00661 00662 for (j=0;j<TargetSize.X;j++,CurCharInfo++,CurChar++) { 00663 *CurChar = CurCharInfo->Char.UnicodeChar; 00664 if (*CurChar == 0) { 00665 *CurChar = UNICODE_SPACE; 00666 } 00667 } 00668 // trim trailing spaces 00669 if (bMungeData) { 00670 CurChar--; 00671 while ((CurChar >= pwchLineStart) && (*CurChar == UNICODE_SPACE)) 00672 CurChar--; 00673 CurChar++; 00674 } 00675 00676 if (bFalseUnicode) { 00677 FalseUnicodeToRealUnicode(pwchLineStart, 00678 (ULONG)(CurChar - pwchLineStart), Console->OutputCP); 00679 } 00680 if (bMungeData) { 00681 *CurChar++ = UNICODE_CARRIAGERETURN; 00682 *CurChar++ = UNICODE_LINEFEED; 00683 } 00684 } 00685 #if defined(FE_SB) 00686 } 00687 #endif 00688 if (bMungeData) { 00689 if (TargetSize.Y) 00690 CurChar -= 2; // don't put CRLF on last line 00691 } 00692 *CurChar = '\0'; // null terminate 00693 00694 #if defined(FE_SB) 00695 if (CONSOLE_IS_DBCS_CP(Console)) { 00696 // extra 4 is for CRLF and DBCS Reserved, extra 1 is for null 00697 ClipboardDataHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 00698 (sizeof(WCHAR) * TargetSize.Y * (TargetSize.X+(4*sizeof(WCHAR)))) + 00699 (1*sizeof(WCHAR))); 00700 if (ClipboardDataHandle == NULL) { 00701 ConsoleHeapFree(Selection); 00702 ConsoleHeapFree(TmpClipboardData); 00703 return; 00704 } 00705 00706 CharBuf = GlobalLock(ClipboardDataHandle); 00707 RtlCopyMemory(CharBuf,TmpClipboardData,ConsoleHeapSize(TmpClipboardData)); 00708 CurChar = CharBuf + (CurChar - TmpClipboardData); 00709 00710 if (wchCARRIAGERETURN == 0x0000) { 00711 /* 00712 * We have False Unicode, so we temporarily represented CRLFs with 00713 * 0x0000s to avoid undesirable conversions (above). 00714 * Convert to Real Unicode and restore real CRLFs. 00715 */ 00716 PWCHAR pwch; 00717 FalseUnicodeToRealUnicode(CharBuf, 00718 (ULONG)(CurChar - CharBuf), 00719 Console->OutputCP 00720 ); 00721 for (pwch = CharBuf; pwch < CurChar; pwch++) { 00722 if ((*pwch == 0x0000) && (pwch[1] == 0x0000)) { 00723 *pwch++ = UNICODE_CARRIAGERETURN; 00724 *pwch = UNICODE_LINEFEED; 00725 } 00726 } 00727 } 00728 } 00729 #endif 00730 00731 GlobalUnlock(ClipboardDataHandle); 00732 #if defined(FE_SB) 00733 if (TmpClipboardData) 00734 ConsoleHeapFree(TmpClipboardData); 00735 #endif 00736 ConsoleHeapFree(Selection); 00737 Success = OpenClipboard(Console->hWnd); 00738 if (!Success) { 00739 GlobalFree(ClipboardDataHandle); 00740 return; 00741 } 00742 00743 Success = EmptyClipboard(); 00744 if (!Success) { 00745 GlobalFree(ClipboardDataHandle); 00746 return; 00747 } 00748 00749 SetClipboardData(CF_UNICODETEXT,ClipboardDataHandle); 00750 CloseClipboard(); // Close clipboard 00751 } else { 00752 HBITMAP hBitmapTarget, hBitmapOld; 00753 HDC hDCMem; 00754 HPALETTE hPaletteOld; 00755 int Height; 00756 00757 NtWaitForSingleObject(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, 00758 FALSE, NULL); 00759 00760 hDCMem = CreateCompatibleDC(Console->hDC); 00761 hBitmapTarget = CreateCompatibleBitmap(Console->hDC, 00762 TargetSize.X, 00763 TargetSize.Y); 00764 if (hBitmapTarget) { 00765 hBitmapOld = SelectObject(hDCMem, hBitmapTarget); 00766 if (ScreenInfo->hPalette) { 00767 hPaletteOld = SelectPalette(hDCMem, 00768 ScreenInfo->hPalette, 00769 FALSE); 00770 } 00771 MyInvert(Console,&Console->SelectionRect); 00772 00773 // if (DIB is a top-down) 00774 // ySrc = abs(height) - rect.bottom - 1; 00775 // else 00776 // ySrc = rect.Bottom. 00777 // 00778 Height = ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo->bmiHeader.biHeight; 00779 00780 StretchDIBits(hDCMem, 0, 0, 00781 TargetSize.X, TargetSize.Y, 00782 Console->SelectionRect.Left + ScreenInfo->Window.Left, 00783 (Height < 0) ? -Height - (Console->SelectionRect.Bottom + ScreenInfo->Window.Top) - 1 00784 : Console->SelectionRect.Bottom + ScreenInfo->Window.Top, 00785 TargetSize.X, TargetSize.Y, 00786 ScreenInfo->BufferInfo.GraphicsInfo.BitMap, 00787 ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo, 00788 ScreenInfo->BufferInfo.GraphicsInfo.dwUsage, 00789 SRCCOPY); 00790 MyInvert(Console,&Console->SelectionRect); 00791 if (ScreenInfo->hPalette) { 00792 SelectPalette(hDCMem, hPaletteOld, FALSE); 00793 } 00794 SelectObject(hDCMem, hBitmapOld); 00795 OpenClipboard(Console->hWnd); 00796 EmptyClipboard(); 00797 SetClipboardData(CF_BITMAP,hBitmapTarget); 00798 CloseClipboard(); 00799 } 00800 DeleteDC(hDCMem); 00801 NtReleaseMutant(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, NULL); 00802 } 00803 00804 }

NTSTATUS StoreTextBufferFontInfo IN PSCREEN_INFORMATION  ScreenInfo,
IN ULONG  FontIndex,
IN COORD  FontSize,
IN BYTE  FontFamily,
IN LONG  FontWeight,
IN LPWSTR  FaceName,
IN UINT  CodePage
 

Definition at line 881 of file w32/ntcon/server/misc.c.

References ConsoleHeapAlloc, _TEXT_BUFFER_FONT_INFO::FaceName, _TEXT_BUFFER_FONT_INFO::Family, FONT_TAG, _TEXT_BUFFER_FONT_INFO::FontCodePage, _TEXT_BUFFER_FONT_INFO::FontNumber, _TEXT_BUFFER_FONT_INFO::FontSize, MAKE_TAG, _TEXT_BUFFER_FONT_INFO::NextTextBufferFont, NULL, and _TEXT_BUFFER_FONT_INFO::Weight.

Referenced by ConvertToFullScreen(), ConvertToWindowed(), CreateScreenBuffer(), SetFont(), and SetScreenBufferFont().

00893 : 00894 00895 This routine store a font information in CurrentTextBufferFont and ListOfTextBufferFont. 00896 If specified code page does not exist in ListOfTextBufferFont, then create new list. 00897 00898 Arguments: 00899 00900 Return Value: 00901 00902 --*/ 00903 00904 { 00905 PTEXT_BUFFER_FONT_INFO CurrentFont, PrevFont; 00906 00907 CurrentFont = ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont; 00908 00909 while (CurrentFont != NULL) { 00910 if (CurrentFont->FontCodePage == CodePage) { 00911 CurrentFont->FontNumber = FontIndex; 00912 CurrentFont->FontSize = FontSize; 00913 CurrentFont->Family = FontFamily; 00914 CurrentFont->Weight = FontWeight; 00915 // CurrentFont->FontCodePage = CodePage; // Redundant 00916 wcscpy(CurrentFont->FaceName, FaceName); 00917 break; 00918 } 00919 PrevFont = CurrentFont; 00920 CurrentFont = CurrentFont->NextTextBufferFont; 00921 } 00922 00923 if (CurrentFont == NULL) { 00924 CurrentFont = ConsoleHeapAlloc(MAKE_TAG( FONT_TAG ), sizeof(TEXT_BUFFER_FONT_INFO)); 00925 if (CurrentFont == NULL) { 00926 return STATUS_NO_MEMORY; 00927 } 00928 00929 CurrentFont->NextTextBufferFont = NULL; 00930 CurrentFont->FontNumber = FontIndex; 00931 CurrentFont->FontSize = FontSize; 00932 CurrentFont->Family = FontFamily; 00933 CurrentFont->Weight = FontWeight; 00934 CurrentFont->FontCodePage = CodePage; 00935 wcscpy(CurrentFont->FaceName, FaceName); 00936 00937 if (ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont == NULL) { 00938 ScreenInfo->BufferInfo.TextInfo.ListOfTextBufferFont = CurrentFont; 00939 } 00940 else { 00941 PrevFont->NextTextBufferFont = CurrentFont; 00942 } 00943 } 00944 00945 ScreenInfo->BufferInfo.TextInfo.CurrentTextBufferFont = *CurrentFont; 00946 ScreenInfo->BufferInfo.TextInfo.CurrentTextBufferFont.NextTextBufferFont = NULL; 00947 00948 return STATUS_SUCCESS; 00949 }

VOID StreamScrollRegion IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 2998 of file output.c.

References ACTIVE_SCREEN_BUFFER, ASSERT, _ATTR_PAIR::Attr, _ATTR_ROW::AttrPair, _ROW::AttrRow, _ATTR_ROW::Attrs, BOOL, Rect::bottom, _ROW::CharRow, _CHAR_ROW::Chars, CONSOLE_IS_ICONIC, CONSOLE_NO_WINDOW, CONSOLE_TEXTMODE_BUFFER, ConsoleHeapFree, ConsoleHideCursor(), ConsoleShowCursor(), _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::FullScreenFlags, ghrgnScroll, _CONSOLE_INFORMATION::hDC, INVALID_OLD_LENGTH, _CHAR_ROW::Left, Rect::left, _ATTR_ROW::Length, _ATTR_PAIR::Length, LockScrollBuffer, max, min, NULL, _CHAR_ROW::OldLeft, _CHAR_ROW::OldRight, PBYTE, Rect, _CHAR_ROW::Right, Rect::right, SCR_FONTSIZE(), ScrollDC(), ScrollEntireScreen(), SHORT, TEXT_VALID_HINT, Rect::top, TRUE, UnlockScrollBuffer, UpdateComplexRegion(), UsePolyTextOut, WINDOW_SIZE_X, WINDOW_SIZE_Y, WriteRegionToScreen, and WriteToScreen.

Referenced by WWSB_AdjustCursorPosition().

03004 : 03005 03006 This routine is a special-purpose scroll for use by 03007 AdjustCursorPosition. 03008 03009 Arguments: 03010 03011 ScreenInfo - pointer to screen buffer info. 03012 03013 Return Value: 03014 03015 --*/ 03016 03017 { 03018 SHORT RowIndex; 03019 PROW Row; 03020 PWCHAR Char; 03021 RECT Rect; 03022 RECT BoundingBox; 03023 int ScreenWidth,ScrollHeight,ScreenHeight; 03024 COORD FontSize; 03025 SMALL_RECT UpdateRegion; 03026 BOOL Success; 03027 int i; 03028 #if defined(FE_SB) 03029 PBYTE AttrP; 03030 #endif 03031 PCONSOLE_INFORMATION Console = ScreenInfo->Console; 03032 03033 RowIndex = ScrollEntireScreen(ScreenInfo,1,TRUE); 03034 03035 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 03036 03037 // 03038 // fill line with blanks 03039 // 03040 03041 Char = &Row->CharRow.Chars[Row->CharRow.Left]; 03042 for (i=Row->CharRow.Left;i<Row->CharRow.Right;i++) { 03043 *Char = (WCHAR)' '; 03044 Char++; 03045 } 03046 #if defined(FE_SB) 03047 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)){ 03048 int LineWidth = Row->CharRow.Right - Row->CharRow.Left; 03049 AttrP = &Row->CharRow.KAttrs[Row->CharRow.Left]; 03050 if ( LineWidth > 0 ) 03051 RtlZeroMemory(AttrP, LineWidth); 03052 AttrP += LineWidth; 03053 Row->CharRow.OldRight = INVALID_OLD_LENGTH; 03054 Row->CharRow.OldLeft = INVALID_OLD_LENGTH; 03055 Console->ConsoleIme.ScrollWaitCountDown = Console->ConsoleIme.ScrollWaitTimeout; 03056 } 03057 #endif 03058 Row->CharRow.Right = 0; 03059 Row->CharRow.Left = ScreenInfo->ScreenBufferSize.X; 03060 03061 // 03062 // set up attributes 03063 // 03064 03065 if (Row->AttrRow.Length != 1) { 03066 ConsoleHeapFree(Row->AttrRow.Attrs); 03067 Row->AttrRow.Attrs = &Row->AttrRow.AttrPair; 03068 Row->AttrRow.AttrPair.Length = ScreenInfo->ScreenBufferSize.X; 03069 Row->AttrRow.Length = 1; 03070 } 03071 Row->AttrRow.AttrPair.Attr = ScreenInfo->Attributes; 03072 03073 // 03074 // update screen 03075 // 03076 03077 if (ACTIVE_SCREEN_BUFFER(ScreenInfo) && 03078 Console->FullScreenFlags == 0 && 03079 !(Console->Flags & (CONSOLE_IS_ICONIC | CONSOLE_NO_WINDOW))) { 03080 03081 ConsoleHideCursor(ScreenInfo); 03082 if (UsePolyTextOut) { 03083 WriteRegionToScreen(ScreenInfo, &ScreenInfo->Window); 03084 } else { 03085 FontSize = SCR_FONTSIZE(ScreenInfo); 03086 ScreenWidth = WINDOW_SIZE_X(&ScreenInfo->Window) * FontSize.X; 03087 ScreenHeight = WINDOW_SIZE_Y(&ScreenInfo->Window) * FontSize.Y; 03088 ScrollHeight = ScreenHeight - FontSize.Y; 03089 03090 Rect.left = 0; 03091 Rect.right = ScreenWidth; 03092 Rect.top = FontSize.Y; 03093 Rect.bottom = ScreenHeight; 03094 03095 // 03096 // find smallest bounding rectangle 03097 // 03098 03099 if (ScreenInfo->BufferInfo.TextInfo.Flags & TEXT_VALID_HINT) { 03100 SHORT MinLeft,MaxRight; 03101 MinLeft = ScreenInfo->ScreenBufferSize.X; 03102 MaxRight = 0; 03103 RowIndex = (ScreenInfo->BufferInfo.TextInfo.FirstRow+ScreenInfo->Window.Top) % ScreenInfo->ScreenBufferSize.Y; 03104 for (i=ScreenInfo->Window.Top+1;i<=ScreenInfo->Window.Bottom;i++) { 03105 Row = &ScreenInfo->BufferInfo.TextInfo.Rows[RowIndex]; 03106 if (Row->CharRow.OldLeft == INVALID_OLD_LENGTH) { 03107 MinLeft = 0; 03108 } else { 03109 if (MinLeft > min(Row->CharRow.Left,Row->CharRow.OldLeft)) { 03110 MinLeft = min(Row->CharRow.Left,Row->CharRow.OldLeft); 03111 } 03112 } 03113 if (Row->CharRow.OldRight == INVALID_OLD_LENGTH) { 03114 MaxRight = ScreenInfo->ScreenBufferSize.X-1; 03115 } else { 03116 if (MaxRight < max(Row->CharRow.Right,Row->CharRow.OldRight)) { 03117 MaxRight = max(Row->CharRow.Right,Row->CharRow.OldRight); 03118 } 03119 } 03120 if (++RowIndex == ScreenInfo->ScreenBufferSize.Y) { 03121 RowIndex = 0; 03122 } 03123 } 03124 Rect.left = MinLeft*FontSize.X; 03125 Rect.right = (MaxRight+1)*FontSize.X; 03126 } 03127 03128 LockScrollBuffer(); 03129 ASSERT (ScreenInfo->BufferInfo.TextInfo.UpdatingScreen>0); 03130 Success = (int)ScrollDC(Console->hDC, 03131 0, 03132 -FontSize.Y, 03133 &Rect, 03134 NULL, 03135 ghrgnScroll, 03136 NULL 03137 ); 03138 if (Success && ScreenInfo->Window.Top!=ScreenInfo->Window.Bottom) { 03139 #if defined(FE_SB) 03140 if (CONSOLE_IS_DBCS_OUTPUTCP(Console) && 03141 ScreenInfo->Attributes & (COMMON_LVB_GRID_HORIZONTAL + 03142 COMMON_LVB_GRID_LVERTICAL + 03143 COMMON_LVB_GRID_RVERTICAL + 03144 COMMON_LVB_REVERSE_VIDEO + 03145 COMMON_LVB_UNDERSCORE )){ 03146 UpdateRegion = ScreenInfo->Window; 03147 UpdateRegion.Top = UpdateRegion.Bottom; 03148 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 03149 WriteToScreen(ScreenInfo,&UpdateRegion); 03150 } 03151 else{ 03152 #endif 03153 switch (GetRgnBox(ghrgnScroll, &BoundingBox)) { 03154 case SIMPLEREGION: 03155 if (BoundingBox.left == 0 && 03156 BoundingBox.right == ScreenWidth && 03157 BoundingBox.top == ScrollHeight && 03158 BoundingBox.bottom == ScreenHeight) { 03159 03160 PatBlt(Console->hDC,0,ScrollHeight,ScreenWidth,FontSize.Y,PATCOPY); 03161 GdiFlush(); 03162 } else { 03163 UpdateRegion.Left = (SHORT)((BoundingBox.left/FontSize.X)+ScreenInfo->Window.Left); 03164 UpdateRegion.Right = (SHORT)(((BoundingBox.right-1)/FontSize.X)+ScreenInfo->Window.Left); 03165 UpdateRegion.Top = (SHORT)((BoundingBox.top/FontSize.Y)+ScreenInfo->Window.Top); 03166 UpdateRegion.Bottom = (SHORT)(((BoundingBox.bottom-1)/FontSize.Y)+ScreenInfo->Window.Top); 03167 WriteToScreen(ScreenInfo,&UpdateRegion); 03168 } 03169 break; 03170 case COMPLEXREGION: 03171 UpdateComplexRegion(ScreenInfo,FontSize); 03172 break; 03173 } 03174 #if defined(FE_SB) 03175 } 03176 #endif 03177 } else { 03178 WriteToScreen(ScreenInfo,&ScreenInfo->Window); 03179 } 03180 UnlockScrollBuffer(); 03181 } 03182 ConsoleShowCursor(ScreenInfo); 03183 } 03184 #ifdef i386 03185 else if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) { 03186 SMALL_RECT ScrollRect; 03187 COORD TargetPoint; 03188 03189 ScrollRect = ScreenInfo->Window; 03190 TargetPoint.Y = ScrollRect.Top; 03191 ScrollRect.Top += 1; 03192 TargetPoint.X = 0; 03193 #if defined(FE_SB) 03194 if (CONSOLE_IS_DBCS_OUTPUTCP(Console) ) { 03195 if (! ScreenInfo->ConvScreenInfo) { 03196 if (ScreenInfo->Console->CurrentScreenBuffer == ScreenInfo) { 03197 ScrollHW(ScreenInfo, 03198 &ScrollRect, 03199 NULL, 03200 TargetPoint 03201 ); 03202 } 03203 } 03204 else if (ScreenInfo->Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 03205 ScrollHW(ScreenInfo, 03206 &ScrollRect, 03207 NULL, 03208 TargetPoint 03209 ); 03210 } 03211 } 03212 else 03213 #endif 03214 ScrollHW(ScreenInfo, 03215 &ScrollRect, 03216 NULL, 03217 TargetPoint 03218 ); 03219 ScrollRect.Top = ScrollRect.Bottom - 1; 03220 WriteRegionToScreenHW(ScreenInfo,&ScrollRect); 03221 } 03222 #endif 03223 }

LPWSTR TranslateConsoleTitle LPWSTR  ConsoleTitle,
PUSHORT  pcbTranslatedLength,
BOOL  Unexpand,
BOOL  Substitute
 

Definition at line 1831 of file srvinit.c.

References ConsoleHeapAlloc, MAKE_TAG, MyStringCompareW(), NULL, PBYTE, SYSTEM_ROOT, SYSTEM_ROOT_LENGTH, TITLE_TAG, TRUE, and USHORT.

Referenced by AllocateConsole(), and GetRegistryValues().

01839 : 01840 01841 This routine translates path characters into '_' characters because 01842 the NT registry apis do not allow the creation of keys with 01843 names that contain path characters. It also converts absolute paths 01844 into %SystemRoot% relative ones. As an example, if both behaviors were 01845 specified it would convert a title like C:\WINNT\System32\cmd.exe to 01846 %SystemRoot%_System32_cmd.exe. 01847 01848 Arguments: 01849 01850 ConsoleTitle - Pointer to string to translate. 01851 01852 pcbTranslatedTitle - On return, contains size of translated title. 01853 01854 Unexpand - Convert absolute path to %SystemRoot% relative one. 01855 01856 Substitute - Replace '\' with '_' in path. 01857 01858 Return Value: 01859 01860 Pointer to translated title or NULL. 01861 01862 Note: 01863 01864 This routine allocates a buffer that must be freed. 01865 01866 --*/ 01867 { 01868 USHORT cbConsoleTitle,i; 01869 USHORT cbSystemRoot; 01870 LPWSTR TranslatedConsoleTitle,Tmp; 01871 01872 cbConsoleTitle = (USHORT)((lstrlenW(ConsoleTitle) + 1) * sizeof(WCHAR)); 01873 cbSystemRoot = (USHORT)(lstrlenW(USER_SHARED_DATA->NtSystemRoot) * sizeof(WCHAR)); 01874 01875 if (Unexpand && !MyStringCompareW(ConsoleTitle, 01876 USER_SHARED_DATA->NtSystemRoot, 01877 cbSystemRoot, 01878 TRUE)) { 01879 cbConsoleTitle -= cbSystemRoot; 01880 (PBYTE)ConsoleTitle += cbSystemRoot; 01881 cbSystemRoot = SYSTEM_ROOT_LENGTH; 01882 } else { 01883 cbSystemRoot = 0; 01884 } 01885 01886 Tmp = TranslatedConsoleTitle = ConsoleHeapAlloc(MAKE_TAG( TITLE_TAG ),cbSystemRoot + cbConsoleTitle); 01887 if (TranslatedConsoleTitle == NULL) { 01888 return NULL; 01889 } 01890 01891 RtlCopyMemory(TranslatedConsoleTitle, SYSTEM_ROOT, cbSystemRoot); 01892 (PBYTE)TranslatedConsoleTitle += cbSystemRoot; 01893 01894 for (i=0;i<cbConsoleTitle;i+=sizeof(WCHAR)) { 01895 if (Substitute && *ConsoleTitle == '\\') { 01896 *TranslatedConsoleTitle++ = (WCHAR)'_'; 01897 } else { 01898 *TranslatedConsoleTitle++ = *ConsoleTitle; 01899 } 01900 ConsoleTitle++; 01901 } 01902 01903 if (pcbTranslatedTitle) { 01904 *pcbTranslatedTitle = cbSystemRoot + cbConsoleTitle; 01905 } 01906 01907 return Tmp; 01908 }

NTSTATUS TranslateOutputToPaddingUnicode IN PCONSOLE_INFORMATION  Console,
IN OUT PCHAR_INFO  OutputBuffer,
IN COORD  Size,
IN OUT PCHAR_INFO  OutputBufferR
 

Definition at line 1191 of file directio.c.

References FALSE, FE_TranslateOutputToAnsiUnicodeInternal(), and Size.

01197 { 01198 return FE_TranslateOutputToAnsiUnicodeInternal(Console, 01199 OutputBuffer, 01200 Size, 01201 OutputBufferR, 01202 FALSE 01203 ); 01204 }

VOID UnblockWriteConsole IN PCONSOLE_INFORMATION  Console,
IN DWORD  Reason
 

Definition at line 2442 of file server/stream.c.

References ASSERT, CONSOLE_SCROLLBAR_TRACKING, CONSOLE_SELECTING, CONSOLE_SUSPENDED, NULL, TRUE, and VOID().

Referenced by ClearSelection(), PreprocessInput(), and VerticalScroll().

02445 { 02446 Console->Flags &= ~Reason; 02447 02448 if ((Console->Flags & (CONSOLE_SUSPENDED | CONSOLE_SELECTING | CONSOLE_SCROLLBAR_TRACKING)) == 0) { 02449 /* 02450 * no remain reason to suspend output, so unblock it. 02451 */ 02452 if (CsrNotifyWait(&Console->OutputQueue, TRUE, NULL, NULL)) { 02453 // #334370 under stress, WaitQueue may already hold the satisfied waits 02454 ASSERT ((Console->WaitQueue == NULL) || 02455 (Console->WaitQueue == &Console->OutputQueue)); 02456 Console->WaitQueue = &Console->OutputQueue; 02457 } 02458 } 02459 }

VOID UnlockConsole IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 4103 of file ntcon/server/input.c.

References ASSERT, CONSOLE_CLIENTPROCESSID, CONSOLE_CTRL_LOGOFF_FLAG, CONSOLE_CTRL_SHUTDOWN_FLAG, CONSOLE_FORCE_SHUTDOWN_FLAG, CONSOLE_SHUTDOWN_SUCCEEDED, CONSOLE_SHUTDOWN_SYSTEM, CONSOLE_SHUTTING_DOWN, ConsoleVDMCriticalSection, ConsoleVDMOnSwitching, _CONSOLE_INFORMATION::CtrlFlags, dwFlags, DWORD, _CONSOLE_INFORMATION::Flags, _CONSOLE_INFORMATION::LimitingProcessId, NT_SUCCESS, NtFreeVirtualMemory(), NtQueryVirtualMemory(), NTSTATUS(), NtTerminateThread(), NULL, ProcessCtrlEvents(), RevalidateConsole(), RtlRaiseStatus(), SHUTDOWN_CANCEL, SHUTDOWN_KNOWN_PROCESS, ShutdownConsole(), Status, UserExitWorkerThread(), ValidateConsole(), _CONSOLE_INFORMATION::VDMProcessId, VOID(), and Zero.

Referenced by ApiPreamble(), ConsoleAddProcessRoutine(), ConsoleClientConnectRoutine(), ConsoleClientShutdown(), ConsoleSetActiveWindow(), ConsoleWindowProc(), FreeCon(), GetThreadConsoleDesktop(), ProcessCreateConsoleWindow(), PropertiesDlgShow(), RemoveConsole(), RevalidateConsole(), SrvAddConsoleAlias(), SrvAllocConsole(), SrvCloseHandle(), SrvConsoleMenuControl(), SrvConsoleNotifyLastClose(), SrvCreateConsoleScreenBuffer(), SrvDuplicateHandle(), SrvExpungeConsoleCommandHistory(), SrvFillConsoleOutput(), SrvFlushConsoleInputBuffer(), SrvGenerateConsoleCtrlEvent(), SrvGetConsoleAlias(), SrvGetConsoleAliases(), SrvGetConsoleAliasesLength(), SrvGetConsoleAliasExes(), SrvGetConsoleAliasExesLength(), SrvGetConsoleCommandHistory(), SrvGetConsoleCommandHistoryLength(), SrvGetConsoleCP(), SrvGetConsoleCurrentFont(), SrvGetConsoleCursorInfo(), SrvGetConsoleDisplayMode(), SrvGetConsoleFontInfo(), SrvGetConsoleFontSize(), SrvGetConsoleHardwareState(), SrvGetConsoleInput(), SrvGetConsoleKeyboardLayoutName(), SrvGetConsoleLangId(), SrvGetConsoleMode(), SrvGetConsoleMouseInfo(), SrvGetConsoleNumberOfFonts(), SrvGetConsoleNumberOfInputEvents(), SrvGetConsoleScreenBufferInfo(), SrvGetConsoleTitle(), SrvGetConsoleWindow(), SrvGetHandleInformation(), SrvGetLargestConsoleWindowSize(), SrvInvalidateBitMapRect(), SrvOpenConsole(), SrvReadConsole(), SrvReadConsoleOutput(), SrvReadConsoleOutputString(), SrvRegisterConsoleVDM(), SrvScrollConsoleScreenBuffer(), SrvSetConsoleActiveScreenBuffer(), SrvSetConsoleCommandHistoryMode(), SrvSetConsoleCP(), SrvSetConsoleCursor(), SrvSetConsoleCursorInfo(), SrvSetConsoleCursorPosition(), SrvSetConsoleDisplayMode(), SrvSetConsoleFont(), SrvSetConsoleHardwareState(), SrvSetConsoleIcon(), SrvSetConsoleKeyShortcuts(), SrvSetConsoleMenuClose(), SrvSetConsoleMode(), SrvSetConsoleNumberOfCommands(), SrvSetConsolePalette(), SrvSetConsoleScreenBufferSize(), SrvSetConsoleTextAttribute(), SrvSetConsoleTitle(), SrvSetConsoleWindowInfo(), SrvSetHandleInformation(), SrvShowConsoleCursor(), SrvVDMConsoleOperation(), SrvVerifyConsoleIoHandle(), SrvWriteConsole(), SrvWriteConsoleInput(), SrvWriteConsoleOutput(), and SrvWriteConsoleOutputString().

04106 { 04107 LIST_ENTRY WaitQueue; 04108 04109 // 04110 // Make sure the console pointer is still valid 04111 // 04112 ASSERT(NT_SUCCESS(ValidateConsole(Console))); 04113 04114 #ifdef i386 04115 // 04116 // do nothing if we are in screen switching(handshaking with ntvdm) 04117 // we don't check anything else because we are in a safe state here. 04118 // 04119 if (ConsoleVDMOnSwitching == Console && 04120 ConsoleVDMOnSwitching->VDMProcessId == CONSOLE_CLIENTPROCESSID()) { 04121 KdPrint((" UnlockConsole - Thread %lx is leaving VDM CritSec\n", GetCurrentThreadId())); 04122 RtlLeaveCriticalSection(&ConsoleVDMCriticalSection); 04123 return; 04124 } 04125 #endif 04126 04127 // 04128 // if we're about to release the console lock, see if there 04129 // are any satisfied wait blocks that need to be dereferenced. 04130 // this code avoids a deadlock between grabbing the console 04131 // lock and then grabbing the process structure lock. 04132 // 04133 #if defined(_X86_) 04134 if (Console->ConsoleLock.RecursionCount == 1) { 04135 #endif 04136 #if defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_) || defined(_IA64_) 04137 if (Console->ConsoleLock.RecursionCount == 0) { 04138 #endif 04139 InitializeListHead(&WaitQueue); 04140 if (Console->WaitQueue) { 04141 CsrMoveSatisfiedWait(&WaitQueue, Console->WaitQueue); 04142 Console->WaitQueue = NULL; 04143 } 04144 ProcessCtrlEvents(Console); 04145 04146 /* 04147 * Can't call CsrDereferenceWait with the console locked or we could deadlock. 04148 */ 04149 if (!IsListEmpty(&WaitQueue)) { 04150 CsrDereferenceWait(&WaitQueue); 04151 } 04152 } else {

BOOLEAN UnProtectHandle HANDLE  hObject  ) 
 

Referenced by AllocateConsole(), RtlDeleteCriticalSection(), and RtlInitializeCriticalSectionAndSpinCount().

BOOL UnqueueThreadMessage DWORD  dwThreadId,
UINT *  pMessage,
WPARAM *  pwParam,
LPARAM *  plParam
 

Definition at line 1906 of file ntcon/server/input.c.

References ASSERT, BOOL, CONSOLE_THREAD_MSG, ConsoleHeapFree, _CONSOLE_THREAD_MSG::dwThreadId, FALSE, gInputThreadMsg, gInputThreadMsgLock, and TRUE.

Referenced by CleanupInputThreadMessages(), ConsoleInputThread(), and DialogHookProc().

01911 { 01912 BOOL fResult = FALSE; // if message is found, set this to TRUE 01913 PLIST_ENTRY pEntry; 01914 01915 ASSERT(dwThreadId); 01916 01917 RtlEnterCriticalSection(&gInputThreadMsgLock); 01918 01919 // 01920 // Search for dwThreadId message from the tail of the queue. 01921 // 01922 pEntry = gInputThreadMsg.Blink; 01923 01924 while (pEntry != &gInputThreadMsg) { 01925 PCONSOLE_THREAD_MSG pConMsg = CONTAINING_RECORD(pEntry, CONSOLE_THREAD_MSG, ListLink); 01926 01927 if (pConMsg->dwThreadId == dwThreadId) { 01928 *pMessage = pConMsg->Message; 01929 *pwParam = pConMsg->wParam; 01930 *plParam = pConMsg->lParam; 01931 01932 RemoveEntryList(pEntry); 01933 ConsoleHeapFree(pConMsg); 01934 fResult = TRUE; 01935 break; 01936 } 01937 pEntry = pEntry->Blink; 01938 } 01939 01940 RtlLeaveCriticalSection(&gInputThreadMsgLock); 01941 01942 return fResult; 01943 }

VOID UnsetActivePalette IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

Definition at line 573 of file server/private.c.

References BOOL, FALSE, NtUserSetInformationThread(), NULL, RealizePalette, and TRUE.

Referenced by ConsoleWindowProc(), and DisplayModeTransition().

00576 { 00577 USERTHREAD_USEDESKTOPINFO utudi; 00578 BOOL bReset = FALSE; 00579 00580 if (GetCurrentThreadId() != ScreenInfo->Console->InputThreadInfo->ThreadId) { 00581 bReset = TRUE; 00582 utudi.hThread = ScreenInfo->Console->InputThreadInfo->ThreadHandle; 00583 utudi.drdRestore.pdeskRestore = NULL; 00584 NtUserSetInformationThread(NtCurrentThread(), 00585 UserThreadUseDesktop, 00586 &utudi, sizeof(utudi)); 00587 } 00588 00589 SetSystemPaletteUse(ScreenInfo->Console->hDC, 00590 SYSPAL_STATIC 00591 ); 00592 RealizePalette(ScreenInfo->Console->hDC); 00593 00594 00595 if (bReset == TRUE) { 00596 utudi.hThread = NULL; 00597 NtUserSetInformationThread(NtCurrentThread(), 00598 UserThreadUseDesktop, &utudi, sizeof(utudi)); 00599 } 00600 }

VOID UpdateMousePosition PSCREEN_INFORMATION  ScreenInfo,
COORD  Position
 

Referenced by HandleMouseEvent().

NTSTATUS ValidateConsole IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 370 of file w32/ntcon/server/handle.c.

References ConsoleHandles, NULL, and NumberOfConsoleHandles.

Referenced by ConsoleWindowProc(), and UnlockConsole().

00376 : 00377 00378 This routine ensures that the given console pointer is valid. 00379 00380 Arguments: 00381 00382 Console - Console pointer to validate. 00383 00384 --*/ 00385 00386 { 00387 ULONG i; 00388 00389 if (Console != NULL) { 00390 for (i = 0; i < NumberOfConsoleHandles; i++) { 00391 if (ConsoleHandles[i] == Console) 00392 return STATUS_SUCCESS; 00393 } 00394 } 00395 return STATUS_UNSUCCESSFUL; 00396 }

VOID VerticalScroll IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo,
IN WORD  ScrollCommand,
IN WORD  AbsoluteChange
 

Definition at line 4575 of file output.c.

References ASSERT, CONSOLE_SCROLLBAR_TRACKING, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_Y, max, min, SetWindowOrigin(), SHORT, TEXT_VALID_HINT, TRUE, and UnblockWriteConsole().

Referenced by ConsoleWindowProc(), and HandleKeyEvent().

04581 { 04582 COORD NewOrigin; 04583 04584 NewOrigin.X = ScreenInfo->Window.Left; 04585 NewOrigin.Y = ScreenInfo->Window.Top; 04586 switch (ScrollCommand) { 04587 case SB_LINEUP: 04588 NewOrigin.Y--; 04589 break; 04590 case SB_LINEDOWN: 04591 NewOrigin.Y++; 04592 break; 04593 case SB_PAGEUP: 04594 #if defined(FE_IME) 04595 // MSKK July.22.1993 KazuM 04596 // Plan of bottom line reservation for console IME. 04597 if ( ScreenInfo->Console->InputBuffer.ImeMode.Open ) 04598 { 04599 ASSERT(ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER); 04600 if (!(ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER)) { 04601 return; 04602 } 04603 NewOrigin.Y-=CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-2; 04604 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 04605 ScreenInfo->BufferInfo.TextInfo.Flags |= CONSOLE_CONVERSION_AREA_REDRAW; 04606 } 04607 else 04608 #endif // FE_IME 04609 NewOrigin.Y-=CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 04610 break; 04611 case SB_PAGEDOWN: 04612 #if defined(FE_IME) 04613 // MSKK July.22.1993 KazuM 04614 // Plan of bottom line reservation for console IME. 04615 if ( ScreenInfo->Console->InputBuffer.ImeMode.Open ) 04616 { 04617 NewOrigin.Y+=CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-2; 04618 ScreenInfo->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 04619 ScreenInfo->BufferInfo.TextInfo.Flags |= CONSOLE_CONVERSION_AREA_REDRAW; 04620 } 04621 else 04622 #endif // FE_IME 04623 NewOrigin.Y+=CONSOLE_WINDOW_SIZE_Y(ScreenInfo)-1; 04624 break; 04625 case SB_THUMBTRACK: 04626 Console->Flags |= CONSOLE_SCROLLBAR_TRACKING; 04627 NewOrigin.Y= AbsoluteChange; 04628 break; 04629 case SB_THUMBPOSITION: 04630 UnblockWriteConsole(Console, CONSOLE_SCROLLBAR_TRACKING); 04631 NewOrigin.Y= AbsoluteChange; 04632 break; 04633 case SB_TOP: 04634 NewOrigin.Y=0; 04635 break; 04636 case SB_BOTTOM: 04637 NewOrigin.Y=(WORD)(ScreenInfo->ScreenBufferSize.Y-CONSOLE_WINDOW_SIZE_Y(ScreenInfo)); 04638 break; 04639 04640 default: 04641 return; 04642 } 04643 04644 NewOrigin.Y = (WORD)(max(0,min((SHORT)NewOrigin.Y, 04645 (SHORT)ScreenInfo->ScreenBufferSize.Y-(SHORT)CONSOLE_WINDOW_SIZE_Y(ScreenInfo)))); 04646 SetWindowOrigin(ScreenInfo, 04647 (BOOLEAN)TRUE, 04648 NewOrigin 04649 ); 04650 }

char WcharToChar IN UINT  Codepage,
IN WCHAR  Wchar
 

Definition at line 1489 of file w32/ntcon/server/misc.c.

References DBGCHARS, NULL, OEMCP, and RtlUnicodeToOemN().

Referenced by FE_WriteRegionToScreenHW(), ReadOutputString(), SB_TranslateOutputToOem(), and TranslateInputToOem().

01492 { 01493 char ch; 01494 if (Codepage == OEMCP) { 01495 RtlUnicodeToOemN(&ch, sizeof(ch), NULL, &Wchar, sizeof(Wchar)); 01496 } else { 01497 WideCharToMultiByte(Codepage, 0, &Wchar, 1, &ch, 1, NULL, NULL); 01498 } 01499 #ifdef DEBUG_PRINT 01500 if (Wchar > 0x007F) { 01501 DBGCHARS(("WcharToChar %d 0x%04x -> 0x%02x\n",Codepage,Wchar,(UCHAR)ch)); 01502 } 01503 #endif 01504 return ch; 01505 }

DWORD WriteInputBuffer PCONSOLE_INFORMATION  Console,
PINPUT_INFORMATION  InputBufferInformation,
PINPUT_RECORD  lpBuffer,
DWORD  nLength
 

NTSTATUS WriteRegionToScreenBitMap IN PSCREEN_INFORMATION  ScreenInfo,
IN PSMALL_RECT  Region
 

Definition at line 293 of file w32/ntcon/server/bitmap.c.

References DWORD, FALSE, InvertSelection(), NtReleaseMutant(), NtWaitForSingleObject(), NULL, and TRUE.

Referenced by ConsoleWindowProc(), and WWSB_WriteToScreen().

00297 { 00298 DWORD NumScanLines; 00299 int Height; 00300 // 00301 // if we have a selection, turn it off. 00302 // 00303 00304 InvertSelection(ScreenInfo->Console,TRUE); 00305 00306 NtWaitForSingleObject(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, 00307 FALSE, NULL); 00308 00309 // The origin of (xSrc, ySrc) passed to SetDIBitsToDevice is located 00310 // at the DIB's bottom-left corner no matter if the DIB is 00311 // a top-down or bottom-up. Thus, if the DIB is a top-down, we have 00312 // to translate ySrc accordingly: 00313 // if (height < 0) { // top-down 00314 // ySrc = abs(height) - rect.Bottom -1; 00315 // 00316 // else 00317 // ySrc = rect.Bottom; 00318 // 00319 Height = ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo->bmiHeader.biHeight; 00320 00321 NumScanLines = SetDIBitsToDevice(ScreenInfo->Console->hDC, 00322 Region->Left - ScreenInfo->Window.Left, 00323 Region->Top - ScreenInfo->Window.Top, 00324 Region->Right - Region->Left + 1, 00325 Region->Bottom - Region->Top + 1, 00326 Region->Left, 00327 Height < 0 ? -Height - Region->Bottom - 1 : Region->Bottom, 00328 0, 00329 ScreenInfo->ScreenBufferSize.Y, 00330 ScreenInfo->BufferInfo.GraphicsInfo.BitMap, 00331 ScreenInfo->BufferInfo.GraphicsInfo.lpBitMapInfo, 00332 ScreenInfo->BufferInfo.GraphicsInfo.dwUsage 00333 ); 00334 00335 NtReleaseMutant(ScreenInfo->BufferInfo.GraphicsInfo.hMutex, NULL); 00336 00337 // 00338 // if we have a selection, turn it on. 00339 // 00340 00341 InvertSelection(ScreenInfo->Console,FALSE); 00342 00343 if (NumScanLines == 0) { 00344 return STATUS_UNSUCCESSFUL; 00345 } 00346 return STATUS_SUCCESS; 00347 }

NTSTATUS WriteScreenBuffer IN PSCREEN_INFORMATION  ScreenInformation,
OUT PCHAR_INFO  Buffer,
IN OUT PSMALL_RECT  WriteRegion
 


Variable Documentation

DWORD dwConBaseTag
 

Definition at line 165 of file consrv.h.

Referenced by ConServerDllInitialization().

PWIN32HEAP pConHeap
 

Definition at line 164 of file consrv.h.

Referenced by ConServerDllInitialization().


Generated on Sat May 15 19:43:16 2004 for test by doxygen 1.3.7