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

private.c File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct  _MODE_FONT_PAIR
struct  _FONTFILEHEADER
struct  _FONTINFOHEADER
struct  _CPENTRYHEADER
struct  _FONTDATAHEADER
struct  _SCREENFONTHEADER

Defines

#define PAL_BLACK   0
#define PAL_BLUE   1
#define PAL_GREEN   2
#define PAL_RED   4
#define PAL_YELLOW   (PAL_RED | PAL_GREEN)
#define PAL_CYAN   (PAL_GREEN | PAL_BLUE)
#define PAL_MAGENTA   (PAL_BLUE | PAL_RED)
#define PAL_WHITE   (PAL_RED | PAL_GREEN | PAL_BLUE)
#define PAL_I_BLACK   (PAL_BLACK + (PAL_WHITE << 3))
#define PAL_I_RED   (PAL_RED + (PAL_RED << 3))
#define PAL_I_GREEN   (PAL_GREEN + (PAL_GREEN << 3))
#define PAL_I_YELLOW   (PAL_YELLOW + (PAL_YELLOW << 3))
#define PAL_I_BLUE   (PAL_BLUE + (PAL_BLUE << 3))
#define PAL_I_CYAN   (PAL_CYAN + (PAL_CYAN << 3))
#define PAL_I_MAGENTA   (PAL_MAGENTA + (PAL_MAGENTA << 3))
#define PAL_I_WHITE   (PAL_WHITE + (PAL_WHITE << 3))
#define INITIAL_PALETTE_SIZE   18
#define NUMBER_OF_MODE_FONT_PAIRS   5
#define CONSOLE_WINDOWS_DIR_LENGTH   256
#define CONSOLE_EGACPI_LENGTH   9
#define CONSOLE_EGACPI   "\\ega.cpi"
#define CONSOLE_FONT_BUFFER_LENGTH   50
#define CONSOLE_DEFAULT_ROM_FONT   437
#define CONSOLE_VDM_TIMEOUT   200000

Typedefs

typedef _MODE_FONT_PAIR MODE_FONT_PAIR
typedef _MODE_FONT_PAIR PMODE_FONT_PAIR
typedef _FONTFILEHEADER FONTFILEHEADER
typedef _FONTFILEHEADERLPFONTFILEHEADER
typedef _FONTINFOHEADER FONTINFOHEADER
typedef _FONTINFOHEADERLPFONTINFOHEADER
typedef _CPENTRYHEADER CPENTRYHEADER
typedef _CPENTRYHEADERLPCPENTRYHEADER
typedef _FONTDATAHEADER FONTDATAHEADER
typedef _FONTDATAHEADERLPFONTDATAHEADER
typedef _SCREENFONTHEADER SCREENFONTHEADER
typedef _SCREENFONTHEADERLPSCREENFONTHEADER

Functions

NTSTATUS MapViewOfSection (PHANDLE SectionHandle, ULONG CommitSize, PVOID *BaseAddress, PSIZE_T ViewSize, HANDLE ClientHandle, PVOID *BaseClientAddress)
NTSTATUS ConnectToEmulator (IN BOOL Connect, IN PCONSOLE_INFORMATION Console)
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)
VOID SetActivePalette (IN PSCREEN_INFORMATION ScreenInfo)
VOID UnsetActivePalette (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS ConvertToFullScreen (IN PCONSOLE_INFORMATION Console)
NTSTATUS ConvertToWindowed (IN PCONSOLE_INFORMATION Console)
ULONG SrvSetConsoleDisplayMode (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
VOID UnregisterVDM (IN PCONSOLE_INFORMATION Console)
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)
NTSTATUS DisplayModeTransition (IN BOOL bForeground, IN PCONSOLE_INFORMATION Console, IN PSCREEN_INFORMATION ScreenInfo)
BOOL InitializeFullScreen (VOID)
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)
DWORD ConvertHotKey (IN LPAPPKEY UserAppKey)
ULONG SrvSetConsoleKeyShortcuts (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)
NTSTATUS GetThreadConsoleDesktop (DWORD dwThreadId, HDESK *phdeskConsole)
NTSTATUS SetRAMFontCodePage (IN PSCREEN_INFORMATION ScreenInfo)
NTSTATUS SetRAMFont (IN PSCREEN_INFORMATION ScreenInfo, IN PCHAR_INFO ScreenBufPtr, IN DWORD Length)

Variables

USHORT InitialPalette [INITIAL_PALETTE_SIZE]
UCHAR ColorBuffer []
MODE_FONT_PAIR ModeFontPairs [NUMBER_OF_MODE_FONT_PAIRS]
HANDLE hCPIFile


Define Documentation

#define CONSOLE_DEFAULT_ROM_FONT   437
 

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

#define CONSOLE_EGACPI   "\\ega.cpi"
 

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

Referenced by InitializeFullScreen().

#define CONSOLE_EGACPI_LENGTH   9
 

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

Referenced by InitializeFullScreen().

#define CONSOLE_FONT_BUFFER_LENGTH   50
 

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

#define CONSOLE_VDM_TIMEOUT   200000
 

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

Referenced by DisplayModeTransition().

#define CONSOLE_WINDOWS_DIR_LENGTH   256
 

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

Referenced by InitializeFullScreen().

#define INITIAL_PALETTE_SIZE   18
 

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

#define NUMBER_OF_MODE_FONT_PAIRS   5
 

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

Referenced by InitializeFullScreen(), and SrvSetConsoleHardwareState().

#define PAL_BLACK   0
 

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

#define PAL_BLUE   1
 

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

#define PAL_CYAN   (PAL_GREEN | PAL_BLUE)
 

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

#define PAL_GREEN   2
 

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

#define PAL_I_BLACK   (PAL_BLACK + (PAL_WHITE << 3))
 

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

#define PAL_I_BLUE   (PAL_BLUE + (PAL_BLUE << 3))
 

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

#define PAL_I_CYAN   (PAL_CYAN + (PAL_CYAN << 3))
 

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

#define PAL_I_GREEN   (PAL_GREEN + (PAL_GREEN << 3))
 

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

#define PAL_I_MAGENTA   (PAL_MAGENTA + (PAL_MAGENTA << 3))
 

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

#define PAL_I_RED   (PAL_RED + (PAL_RED << 3))
 

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

#define PAL_I_WHITE   (PAL_WHITE + (PAL_WHITE << 3))
 

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

#define PAL_I_YELLOW   (PAL_YELLOW + (PAL_YELLOW << 3))
 

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

#define PAL_MAGENTA   (PAL_BLUE | PAL_RED)
 

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

#define PAL_RED   4
 

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

#define PAL_WHITE   (PAL_RED | PAL_GREEN | PAL_BLUE)
 

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

#define PAL_YELLOW   (PAL_RED | PAL_GREEN)
 

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


Typedef Documentation

typedef struct _CPENTRYHEADER CPENTRYHEADER
 

typedef struct _FONTDATAHEADER FONTDATAHEADER
 

typedef struct _FONTFILEHEADER FONTFILEHEADER
 

typedef struct _FONTINFOHEADER FONTINFOHEADER
 

typedef struct _CPENTRYHEADER * LPCPENTRYHEADER
 

typedef struct _FONTDATAHEADER * LPFONTDATAHEADER
 

typedef struct _FONTFILEHEADER * LPFONTFILEHEADER
 

typedef struct _FONTINFOHEADER * LPFONTINFOHEADER
 

typedef struct _SCREENFONTHEADER * LPSCREENFONTHEADER
 

typedef struct _MODE_FONT_PAIR MODE_FONT_PAIR
 

typedef struct _MODE_FONT_PAIR PMODE_FONT_PAIR
 

typedef struct _SCREENFONTHEADER SCREENFONTHEADER
 


Function Documentation

NTSTATUS ConnectToEmulator IN BOOL  Connect,
IN PCONSOLE_INFORMATION  Console
 

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

References ASSERT, CONSOLE_CONNECTED_TO_EMULATOR, CONSOLE_HAS_FOCUS, DBGFULLSCR, NTSTATUS(), NtUserSetInformationThread(), NULL, Status, and TIF_DOSEMULATOR.

Referenced by DisplayModeTransition(), SrvRegisterConsoleVDM(), and UnregisterVDM().

01523 { 01524 NTSTATUS Status; 01525 FULLSCREENCONTROL fsctl; 01526 VIDEO_VDM ConnectInfo; 01527 HANDLE ProcessHandle = Console->VDMProcessHandle; 01528 USERTHREAD_FLAGS Flags; 01529 01530 DBGFULLSCR(("ConnectToEmulator : %s - entering\n", Connect ? "CONNECT" : "DISCONNECT")); 01531 01532 Flags.dwMask = TIF_DOSEMULATOR; 01533 if (Connect) { 01534 fsctl = FullscreenControlEnable; 01535 Console->Flags |= CONSOLE_CONNECTED_TO_EMULATOR; 01536 Flags.dwFlags = TIF_DOSEMULATOR; 01537 } else { 01538 fsctl = FullscreenControlDisable; 01539 Console->Flags &= ~CONSOLE_CONNECTED_TO_EMULATOR; 01540 Flags.dwFlags = 0; 01541 } 01542 01543 if (Console->Flags & CONSOLE_HAS_FOCUS) { 01544 NtUserSetInformationThread(Console->InputThreadInfo->ThreadHandle, 01545 UserThreadFlags, &Flags, sizeof(Flags)); 01546 } 01547 01548 ConnectInfo.ProcessHandle = ProcessHandle; 01549 01550 01551 Status = GdiFullscreenControl(fsctl, 01552 &ConnectInfo, 01553 sizeof(ConnectInfo), 01554 NULL, 01555 NULL); 01556 01557 ASSERT(Status == STATUS_SUCCESS || Status == STATUS_PROCESS_IS_TERMINATING); 01558 01559 DBGFULLSCR(("ConnectToEmulator : leaving, staus = %08lx\n", Status)); 01560 01561 return Status; 01562 }

DWORD ConvertHotKey IN LPAPPKEY  UserAppKey  ) 
 

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

References DWORD, and MapVirtualKey().

Referenced by SrvSetConsoleKeyShortcuts().

02406 { 02407 DWORD wParam; 02408 02409 wParam = MapVirtualKey(UserAppKey->ScanCode,1); 02410 if (UserAppKey->Modifier & CONSOLE_MODIFIER_SHIFT) { 02411 wParam |= 0x0100; 02412 } 02413 if (UserAppKey->Modifier & CONSOLE_MODIFIER_CONTROL) { 02414 wParam |= 0x0200; 02415 } 02416 if (UserAppKey->Modifier & CONSOLE_MODIFIER_ALT) { 02417 wParam |= 0x0400; 02418 } 02419 return wParam; 02420 }

NTSTATUS ConvertToFullScreen IN PCONSOLE_INFORMATION  Console  ) 
 

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

References ASSERT, _SCREEN_INFORMATION::BufferInfo, CONSOLE_GRAPHICS_BUFFER, CONSOLE_OEMFONT_DISPLAY, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, DBGCHARS, DbgPrint, FALSE, FalseUnicodeToRealUnicode(), _SCREEN_INFORMATION::Flags, max, _SCREEN_INFORMATION::Next, NT_SUCCESS, NTSTATUS(), NULL, ResizeScreenBuffer(), SCR_FACENAME(), SCR_FAMILY(), SCR_FONTCODEPAGE(), SCR_FONTNUMBER(), SCR_FONTSIZE(), SCR_FONTWEIGHT(), _SCREEN_INFORMATION::ScreenBufferSize, SetWindowSize(), Status, StoreTextBufferFontInfo(), TEXT_VALID_HINT, _SCREEN_INFORMATION::Window, and WriteToScreen.

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

00606 { 00607 #ifdef i386 00608 PSCREEN_INFORMATION Cur; 00609 COORD WindowedWindowSize, WindowSize; 00610 00611 // for each charmode screenbuffer 00612 // match window size to a mode/font 00613 // grow screen buffer if necessary 00614 // save old window dimensions 00615 // set new window dimensions 00616 00617 for (Cur=Console->ScreenBuffers;Cur!=NULL;Cur=Cur->Next) { 00618 00619 if (Cur->Flags & CONSOLE_GRAPHICS_BUFFER) { 00620 continue; 00621 } 00622 00623 // save old window dimensions 00624 00625 WindowedWindowSize.X = CONSOLE_WINDOW_SIZE_X(Cur); 00626 WindowedWindowSize.Y = CONSOLE_WINDOW_SIZE_Y(Cur); 00627 00628 Cur->BufferInfo.TextInfo.WindowedWindowSize = WindowedWindowSize; 00629 Cur->BufferInfo.TextInfo.WindowedScreenSize = Cur->ScreenBufferSize; 00630 00631 // match window size to a mode/font 00632 00633 Cur->BufferInfo.TextInfo.ModeIndex = MatchWindowSize( 00634 Console->OutputCP, 00635 Cur->ScreenBufferSize, &WindowSize); 00636 00637 // grow screen buffer if necessary 00638 00639 if (WindowSize.X > Cur->ScreenBufferSize.X || 00640 WindowSize.Y > Cur->ScreenBufferSize.Y) { 00641 COORD NewScreenSize; 00642 00643 NewScreenSize.X = max(WindowSize.X,Cur->ScreenBufferSize.X); 00644 NewScreenSize.Y = max(WindowSize.Y,Cur->ScreenBufferSize.Y); 00645 00646 if (ResizeScreenBuffer(Cur, NewScreenSize, FALSE) == STATUS_INVALID_HANDLE) { 00647 return STATUS_INVALID_HANDLE; 00648 } 00649 } 00650 00651 #if 0 00652 DbgPrint("new window size is %d %d\n",WindowSize.X,WindowSize.Y); 00653 DbgPrint("existing window size is %d %d\n",WindowedWindowSize.X,WindowedWindowSize.Y); 00654 DbgPrint("existing window is %d %d %d %d\n",Cur->Window.Left,Cur->Window.Top,Cur->Window.Right,Cur->Window.Bottom); 00655 DbgPrint("screenbuffersize is %d %d\n",Cur->ScreenBufferSize.X,Cur->ScreenBufferSize.Y); 00656 #endif 00657 // set new window dimensions 00658 // we always resize horizontally from the right (change the 00659 // right edge). 00660 // we resize vertically from the bottom, keeping the cursor visible. 00661 00662 if (WindowedWindowSize.X != WindowSize.X) { 00663 Cur->Window.Right -= WindowedWindowSize.X - WindowSize.X; 00664 if (Cur->Window.Right >= Cur->ScreenBufferSize.X) { 00665 Cur->Window.Left -= Cur->Window.Right - Cur->ScreenBufferSize.X + 1; 00666 Cur->Window.Right -= Cur->Window.Right - Cur->ScreenBufferSize.X + 1; 00667 } 00668 } 00669 if (WindowedWindowSize.Y > WindowSize.Y) { 00670 Cur->Window.Bottom -= WindowedWindowSize.Y - WindowSize.Y; 00671 if (Cur->Window.Bottom >= Cur->ScreenBufferSize.Y) { 00672 Cur->Window.Top -= Cur->Window.Bottom - Cur->ScreenBufferSize.Y + 1; 00673 Cur->Window.Bottom = Cur->ScreenBufferSize.Y - 1; 00674 } 00675 } else if (WindowedWindowSize.Y < WindowSize.Y) { 00676 Cur->Window.Top -= WindowSize.Y - WindowedWindowSize.Y; 00677 if (Cur->Window.Top < 0) { 00678 Cur->Window.Bottom -= Cur->Window.Top; 00679 Cur->Window.Top = 0; 00680 } 00681 } 00682 if (Cur->BufferInfo.TextInfo.CursorPosition.Y > Cur->Window.Bottom) { 00683 Cur->Window.Top += Cur->BufferInfo.TextInfo.CursorPosition.Y - Cur->Window.Bottom; 00684 Cur->Window.Bottom = Cur->BufferInfo.TextInfo.CursorPosition.Y; 00685 } 00686 #if 0 00687 DbgPrint("new window is %d %d %d %d\n",Cur->Window.Left,Cur->Window.Top,Cur->Window.Right,Cur->Window.Bottom); 00688 DbgPrint("cursor is %d %d\n",Cur->BufferInfo.TextInfo.CursorPosition.X,Cur->BufferInfo.TextInfo.CursorPosition.Y); 00689 #endif 00690 ASSERT(WindowSize.X == CONSOLE_WINDOW_SIZE_X(Cur)); 00691 ASSERT(WindowSize.Y == CONSOLE_WINDOW_SIZE_Y(Cur)); 00692 Cur->BufferInfo.TextInfo.MousePosition.X = Cur->Window.Left; 00693 Cur->BufferInfo.TextInfo.MousePosition.Y = Cur->Window.Top; 00694 00695 if (Cur->Flags & CONSOLE_OEMFONT_DISPLAY) { 00696 DBGCHARS(("ConvertToFullScreen converts UnicodeOem -> Unicode\n")); 00697 FalseUnicodeToRealUnicode( 00698 Cur->BufferInfo.TextInfo.TextRows, 00699 Cur->ScreenBufferSize.X * Cur->ScreenBufferSize.Y, 00700 Console->OutputCP); 00701 } else { 00702 DBGCHARS(("ConvertToFullScreen needs no conversion\n")); 00703 } 00704 DBGCHARS(("Cur->BufferInfo.TextInfo.Rows = %lx\n", 00705 Cur->BufferInfo.TextInfo.Rows)); 00706 DBGCHARS(("Cur->BufferInfo.TextInfo.TextRows = %lx\n", 00707 Cur->BufferInfo.TextInfo.TextRows)); 00708 } 00709 00710 Cur = Console->CurrentScreenBuffer; 00711 00712 if (Cur->Flags & CONSOLE_TEXTMODE_BUFFER) { 00713 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 00714 PCONVERSIONAREA_INFORMATION ConvAreaInfo; 00715 ConvAreaInfo = Console->ConsoleIme.ConvAreaRoot; 00716 while (ConvAreaInfo) { 00717 NTSTATUS Status; 00718 00719 Status = StoreTextBufferFontInfo(ConvAreaInfo->ScreenBuffer, 00720 SCR_FONTNUMBER(Cur), 00721 SCR_FONTSIZE(Cur), 00722 SCR_FAMILY(Cur), 00723 SCR_FONTWEIGHT(Cur), 00724 SCR_FACENAME(Cur), 00725 SCR_FONTCODEPAGE(Cur)); 00726 if (!NT_SUCCESS(Status)) { 00727 return((ULONG) Status); 00728 } 00729 00730 ConvAreaInfo->ScreenBuffer->BufferInfo.TextInfo.ModeIndex = Cur->BufferInfo.TextInfo.ModeIndex; 00731 ConvAreaInfo = ConvAreaInfo->ConvAreaNext; 00732 } 00733 } 00734 Cur->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 00735 } 00736 00737 SetWindowSize(Cur); 00738 WriteToScreen(Cur, &Console->CurrentScreenBuffer->Window); 00739 00740 #else 00741 UNREFERENCED_PARAMETER(Console); 00742 #endif 00743 return STATUS_SUCCESS; 00744 }

NTSTATUS ConvertToWindowed IN PCONSOLE_INFORMATION  Console  ) 
 

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

References _SCREEN_INFORMATION::BufferInfo, CONSOLE_OEMFONT_DISPLAY, CONSOLE_TEXTMODE_BUFFER, DBGCHARS, FALSE, _SCREEN_INFORMATION::Flags, _SCREEN_INFORMATION::Next, NT_SUCCESS, NTSTATUS(), NULL, RealUnicodeToFalseUnicode(), ResizeScreenBuffer(), ResizeWindow(), SCR_FACENAME(), SCR_FAMILY(), SCR_FONTCODEPAGE(), SCR_FONTNUMBER(), SCR_FONTSIZE(), SCR_FONTWEIGHT(), _SCREEN_INFORMATION::ScreenBufferSize, SetFont(), SetWindowSize(), Status, StoreTextBufferFontInfo(), TEXT_VALID_HINT, _SCREEN_INFORMATION::Window, and WriteToScreen.

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

00750 { 00751 #ifdef i386 00752 PSCREEN_INFORMATION Cur; 00753 SMALL_RECT WindowedWindow; 00754 00755 // for each charmode screenbuffer 00756 // restore window dimensions 00757 00758 for (Cur=Console->ScreenBuffers;Cur!=NULL;Cur=Cur->Next) { 00759 if ((Cur->Flags & CONSOLE_TEXTMODE_BUFFER) == 0) { 00760 continue; 00761 } 00762 00763 if (ResizeScreenBuffer(Cur, 00764 Cur->BufferInfo.TextInfo.WindowedScreenSize, 00765 FALSE) == STATUS_INVALID_HANDLE) { 00766 /* 00767 * Something really went wrong. All we can do is just to 00768 * bail out. 00769 */ 00770 return STATUS_INVALID_HANDLE; 00771 } 00772 00773 WindowedWindow.Right = Cur->Window.Right; 00774 WindowedWindow.Bottom = Cur->Window.Bottom; 00775 WindowedWindow.Left = Cur->Window.Right + 1 - 00776 Cur->BufferInfo.TextInfo.WindowedWindowSize.X; 00777 WindowedWindow.Top = Cur->Window.Bottom + 1 - 00778 Cur->BufferInfo.TextInfo.WindowedWindowSize.Y; 00779 if (WindowedWindow.Left > Cur->Window.Left) { 00780 WindowedWindow.Right -= WindowedWindow.Left - Cur->Window.Left; 00781 WindowedWindow.Left = Cur->Window.Left; 00782 } 00783 if (WindowedWindow.Right < Cur->BufferInfo.TextInfo.CursorPosition.X) { 00784 WindowedWindow.Left += Cur->BufferInfo.TextInfo.CursorPosition.X - WindowedWindow.Right; 00785 WindowedWindow.Right = Cur->BufferInfo.TextInfo.CursorPosition.X; 00786 } 00787 if (WindowedWindow.Top > Cur->Window.Top) { 00788 WindowedWindow.Bottom -= WindowedWindow.Top - Cur->Window.Top; 00789 WindowedWindow.Top = Cur->Window.Top; 00790 } 00791 if (WindowedWindow.Bottom < Cur->BufferInfo.TextInfo.CursorPosition.Y) { 00792 WindowedWindow.Top += Cur->BufferInfo.TextInfo.CursorPosition.Y - WindowedWindow.Bottom; 00793 WindowedWindow.Bottom = Cur->BufferInfo.TextInfo.CursorPosition.Y; 00794 } 00795 ResizeWindow(Cur, &WindowedWindow, FALSE); 00796 00797 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 00798 SetFont(Cur); 00799 } 00800 00801 if (Cur->Flags & CONSOLE_OEMFONT_DISPLAY) { 00802 DBGCHARS(("ConvertToWindowed converts Unicode -> UnicodeOem\n")); 00803 RealUnicodeToFalseUnicode( 00804 Cur->BufferInfo.TextInfo.TextRows, 00805 Cur->ScreenBufferSize.X * Cur->ScreenBufferSize.Y, 00806 Console->OutputCP); 00807 } else { 00808 DBGCHARS(("ConvertToWindowed needs no conversion\n")); 00809 } 00810 DBGCHARS(("Cur->BufferInfo.TextInfo.Rows = %lx\n", 00811 Cur->BufferInfo.TextInfo.Rows)); 00812 DBGCHARS(("Cur->BufferInfo.TextInfo.TextRows = %lx\n", 00813 Cur->BufferInfo.TextInfo.TextRows)); 00814 } 00815 00816 Cur = Console->CurrentScreenBuffer; 00817 00818 if (Cur->Flags & CONSOLE_TEXTMODE_BUFFER) { 00819 if (CONSOLE_IS_DBCS_OUTPUTCP(Console)) { 00820 PCONVERSIONAREA_INFORMATION ConvAreaInfo; 00821 ConvAreaInfo = Console->ConsoleIme.ConvAreaRoot; 00822 while (ConvAreaInfo) { 00823 NTSTATUS Status; 00824 00825 Status = StoreTextBufferFontInfo(ConvAreaInfo->ScreenBuffer, 00826 SCR_FONTNUMBER(Cur), 00827 SCR_FONTSIZE(Cur), 00828 SCR_FAMILY(Cur), 00829 SCR_FONTWEIGHT(Cur), 00830 SCR_FACENAME(Cur), 00831 SCR_FONTCODEPAGE(Cur)); 00832 if (!NT_SUCCESS(Status)) { 00833 return((ULONG) Status); 00834 } 00835 00836 ConvAreaInfo->ScreenBuffer->BufferInfo.TextInfo.ModeIndex = Cur->BufferInfo.TextInfo.ModeIndex; 00837 ConvAreaInfo = ConvAreaInfo->ConvAreaNext; 00838 } 00839 } 00840 Cur->BufferInfo.TextInfo.Flags &= ~TEXT_VALID_HINT; 00841 } 00842 00843 SetWindowSize(Cur); 00844 WriteToScreen(Cur, &Console->CurrentScreenBuffer->Window); 00845 00846 #else 00847 UNREFERENCED_PARAMETER(Console); 00848 #endif 00849 return STATUS_SUCCESS; 00850 }

NTSTATUS DisplayModeTransition IN BOOL  bForeground,
IN PCONSOLE_INFORMATION  Console,
IN PSCREEN_INFORMATION  ScreenInfo
 

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

References ASSERT, BOOL, _SCREEN_INFORMATION::BufferInfo, ConnectToEmulator(), _SCREEN_INFORMATION::Console, CONSOLE_CONNECTED_TO_EMULATOR, CONSOLE_FULLSCREEN_NOPAINT, CONSOLE_GRAPHICS_BUFFER, CONSOLE_VDM_REGISTERED, CONSOLE_VDM_TIMEOUT, ConsoleVDMCriticalSection, ConsoleVDMOnSwitching, FALSE, _SCREEN_INFORMATION::Flags, FS_MODE_GRAPHICS, FullScreenInitialized, HandleFocusEvent(), _CONSOLE_INFORMATION::hDC, _SCREEN_INFORMATION::hPalette, _CONSOLE_INFORMATION::hSysPalette, Index, INVALID_OLD_LENGTH, IsAvailableFsCodePage(), _MODE_FONT_PAIR::Mode, ModeFontPairs, ModifyConsoleProcessFocus(), NT_SUCCESS, NtSignalAndWaitForSingleObject(), NTSTATUS(), NtUserConsoleControl(), NULL, RegModeFontPairs, _MODE_FONT_PAIR::Resolution, _SCREEN_INFORMATION::ScreenBufferSize, SelectPalette, SetActivePalette(), SetConsoleReserveKeys(), Status, TRUE, UnregisterVDM(), UnsetActivePalette(), _SCREEN_INFORMATION::Window, and WriteRegionToScreen.

Referenced by ConsoleWindowProc().

01572 { 01573 #ifdef i386 01574 NTSTATUS Status; 01575 LARGE_INTEGER li; 01576 01577 if (!FullScreenInitialized) 01578 return STATUS_SUCCESS; 01579 01580 if (bForeground) { 01581 01582 PSCREEN_INFORMATION ScreenInfo = Console->CurrentScreenBuffer; 01583 LARGE_INTEGER li; 01584 NTSTATUS Status; 01585 01586 KdPrint((" CONSRV - Display Mode transition to fullscreen \n")); 01587 01588 if (!(Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 01589 KdPrint(("CONSRV: received fullscreen message too early\n")); 01590 return STATUS_UNSUCCESSFUL; 01591 } 01592 01593 Console->FullScreenFlags |= CONSOLE_FULLSCREEN_HARDWARE; 01594 01595 if (!(ScreenInfo->Flags & CONSOLE_GRAPHICS_BUFFER)) { 01596 #if defined(FE_SB) 01597 BOOL fGraphics = fFullScreenGraphics ? IsAvailableFsCodePage(Console->OutputCP) : FALSE; 01598 #endif 01599 #if 1 01600 DEVMODEW Devmode; 01601 ULONG Index; 01602 01603 KdPrint(("CONSRV: ChangeDispSettings fullscreen\n")); 01604 01605 Index = Console->CurrentScreenBuffer->BufferInfo.TextInfo.ModeIndex; 01606 01607 // 01608 // set mode to go to full screen 01609 // 01610 01611 ZeroMemory(&Devmode, sizeof(Devmode)); 01612 01613 Devmode.dmSize = sizeof(Devmode); 01614 Devmode.dmDriverExtra = 0; 01615 Devmode.dmFields = DM_BITSPERPEL | 01616 DM_PELSWIDTH | 01617 DM_PELSHEIGHT | 01618 DM_DISPLAYFLAGS; 01619 01620 Devmode.dmBitsPerPel = 4; 01621 #if defined(FE_SB) 01622 Devmode.dmPelsWidth = RegModeFontPairs[Index].Resolution.X; 01623 Devmode.dmPelsHeight = RegModeFontPairs[Index].Resolution.Y; 01624 Devmode.dmDisplayFlags = (fGraphics && (RegModeFontPairs[Index].Mode & FS_MODE_GRAPHICS)) ? 0 : DMDISPLAYFLAGS_TEXTMODE; 01625 #else 01626 Devmode.dmPelsWidth = ModeFontPairs[Index].Resolution.X; 01627 Devmode.dmPelsHeight = ModeFontPairs[Index].Resolution.Y; 01628 Devmode.dmDisplayFlags = DMDISPLAYFLAGS_TEXTMODE; 01629 #endif 01630 01631 if (NT_SUCCESS(GdiFullscreenControl(FullscreenControlSetMode, 01632 &Devmode, 01633 sizeof(Devmode), 01634 NULL, 01635 NULL))) 01636 { 01637 #endif 01638 // set video mode and font 01639 if (SetVideoMode(ScreenInfo)) { 01640 01641 #if defined(FE_SB) 01642 if (!(Console->Flags & CONSOLE_VDM_REGISTERED)) { 01643 int i ; 01644 for (i = 0 ; i < ScreenInfo->ScreenBufferSize.Y; i++) { 01645 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.OldLeft = INVALID_OLD_LENGTH ; 01646 ScreenInfo->BufferInfo.TextInfo.Rows[i].CharRow.OldRight = INVALID_OLD_LENGTH ; 01647 } 01648 } 01649 #endif 01650 //set up cursor 01651 01652 SetCursorInformationHW(ScreenInfo, 01653 ScreenInfo->BufferInfo.TextInfo.CursorSize, 01654 ScreenInfo->BufferInfo.TextInfo.CursorVisible); 01655 SetCursorPositionHW(ScreenInfo, 01656 ScreenInfo->BufferInfo.TextInfo.CursorPosition); 01657 } 01658 } 01659 } 01660 01661 // tell VDM to unmap memory 01662 01663 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01664 li.QuadPart = (LONGLONG)-10000 * CONSOLE_VDM_TIMEOUT; 01665 Status = NtSignalAndWaitForSingleObject(Console->VDMStartHardwareEvent, 01666 Console->VDMEndHardwareEvent, 01667 FALSE, &li); 01668 if (Status != 0) { 01669 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 01670 UnregisterVDM(Console); 01671 KdPrint(("CONSRV: VDM not responding.\n")); 01672 } 01673 } 01674 01675 if (!(ScreenInfo->Flags & CONSOLE_GRAPHICS_BUFFER)) { 01676 01677 WriteRegionToScreen(ScreenInfo,&ScreenInfo->Window); 01678 } 01679 01680 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01681 01682 // connect emulator and map memory into the VDMs address space. 01683 ASSERT(!(Console->Flags & CONSOLE_CONNECTED_TO_EMULATOR)); 01684 01685 Status = ConnectToEmulator(TRUE, Console); 01686 01687 if (NT_SUCCESS(Status)) { 01688 01689 VIDEO_HARDWARE_STATE State; 01690 ULONG StateSize = sizeof(State); 01691 01692 State.StateHeader = Console->StateBuffer; 01693 State.StateLength = Console->StateLength; 01694 01695 01696 Status = GdiFullscreenControl(FullscreenControlRestoreHardwareState, 01697 &State, 01698 StateSize, 01699 &State, 01700 &StateSize); 01701 } 01702 01703 if (Status != STATUS_SUCCESS) { 01704 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 01705 UnregisterVDM(Console); 01706 KdPrint(("CONSRV: set hardware state failed.\n")); 01707 } else { 01708 01709 // 01710 // tell VDM that it's getting the hardware. 01711 // 01712 01713 RECT CursorRect; 01714 CursorRect.left = -32767; 01715 CursorRect.top = -32767; 01716 CursorRect.right = 32767; 01717 CursorRect.bottom = 32767; 01718 NtUserConsoleControl(ConsoleSetVDMCursorBounds, 01719 &CursorRect, sizeof(RECT)); 01720 01721 // wait for vdm to say ok. We could initiate another switch 01722 // (set hStartHardwareEvent which vdm is now waiting for to 01723 // complete the handshaking) when we return(WM_FULLSCREEN 01724 // could be in the message queue already). If we don't wait 01725 // for vdm to get signaled here, the hStartHardwareEvent 01726 // can get set twice and signaled once so the vdm will never 01727 // gets the newly switch request we may post after return. 01728 NtSignalAndWaitForSingleObject(Console->VDMStartHardwareEvent, 01729 Console->VDMEndHardwareEvent, 01730 FALSE, &li); 01731 // no need to check time out here 01732 01733 } 01734 01735 } 01736 01737 // 01738 // let the app know that it has the focus. 01739 // 01740 01741 HandleFocusEvent(Console,TRUE); 01742 01743 // unset palette 01744 01745 if (ScreenInfo->hPalette != NULL) { 01746 SelectPalette(ScreenInfo->Console->hDC, 01747 ScreenInfo->Console->hSysPalette, 01748 FALSE); 01749 UnsetActivePalette(ScreenInfo); 01750 } 01751 SetConsoleReserveKeys(Console->hWnd, Console->ReserveKeys); 01752 HandleFocusEvent(Console,TRUE); 01753 01754 } else { 01755 01756 KdPrint((" CONSRV - Display Mode transition to windowed \n")); 01757 01758 // 01759 // Check first to see if we're not already fullscreen. If we aren't, 01760 // don't allow this. Temporary BETA fix till USER gets fixed. 01761 // 01762 if (!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)) { 01763 KdPrint(("CONSRV: received multiple windowed messages\n")); 01764 return STATUS_SUCCESS; 01765 } 01766 01767 // turn off mouse pointer so VDM doesn't see it when saving 01768 // hardware 01769 if (!(ScreenInfo->Flags & CONSOLE_GRAPHICS_BUFFER)) { 01770 ReverseMousePointer(ScreenInfo, &ScreenInfo->Window); 01771 } 01772 01773 01774 Console->FullScreenFlags &= ~CONSOLE_FULLSCREEN_HARDWARE; 01775 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01776 01777 // 01778 // tell vdm that it's losing the hardware 01779 // 01780 01781 li.QuadPart = (LONGLONG)-10000 * CONSOLE_VDM_TIMEOUT; 01782 Status = NtSignalAndWaitForSingleObject(Console->VDMStartHardwareEvent, 01783 Console->VDMEndHardwareEvent, 01784 FALSE, &li); 01785 01786 // if ntvdm didn't respond or we failed to save the video hardware 01787 // states, kick ntvdm out of our world. The ntvdm process eventually 01788 // would die but what choice do have here? 01789 01790 if (NT_SUCCESS(Status)) { 01791 01792 VIDEO_HARDWARE_STATE State; 01793 ULONG StateSize = sizeof(State); 01794 01795 State.StateHeader = Console->StateBuffer; 01796 State.StateLength = Console->StateLength; 01797 01798 01799 Status = GdiFullscreenControl(FullscreenControlSaveHardwareState, 01800 &State, 01801 StateSize, 01802 &State, 01803 &StateSize); 01804 } 01805 01806 if (NT_SUCCESS(Status)) { 01807 01808 01809 NtUserConsoleControl(ConsoleSetVDMCursorBounds, NULL, 0); 01810 01811 // disconnect emulator and unmap video memory 01812 01813 ASSERT(Console->Flags & CONSOLE_CONNECTED_TO_EMULATOR); 01814 ConnectToEmulator(FALSE, Console); 01815 01816 } else { 01817 01818 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 01819 UnregisterVDM(Console); 01820 if (Status != 0) { 01821 KdPrint(("CONSRV: VDM not responding.\n")); 01822 } 01823 else 01824 KdPrint(("CONSRV: Save Video States Failed\n")); 01825 01826 } 01827 } 01828 01829 // tell VDM to map memory 01830 01831 if (Console->Flags & CONSOLE_VDM_REGISTERED) { 01832 01833 // make a special case for ntvdm during switching because 01834 // ntvdm has to make console api calls. We don't want to 01835 // unlock the console at this moment because as soon as 01836 // we release the lock, other theads which are waiting 01837 // for the lock will claim the lock and the ntvdm thread doing 01838 // the screen switch will have to wait for the lock. In an 01839 // extreme case, the following NtWaitForSingleObject will time 01840 // out because the ntvdm may be still waiting for the lock. 01841 // We keep this thing in a single global variable because 01842 // there is only one process who can own the screen at any moment. 01843 01844 RtlEnterCriticalSection(&ConsoleVDMCriticalSection); 01845 ConsoleVDMOnSwitching = Console; 01846 RtlLeaveCriticalSection(&ConsoleVDMCriticalSection); 01847 li.QuadPart = (LONGLONG)-10000 * CONSOLE_VDM_TIMEOUT; 01848 Status = NtSignalAndWaitForSingleObject(Console->VDMStartHardwareEvent, 01849 Console->VDMEndHardwareEvent, 01850 FALSE, &li); 01851 01852 // time to go back to normal 01853 RtlEnterCriticalSection(&ConsoleVDMCriticalSection); 01854 ConsoleVDMOnSwitching = NULL; 01855 RtlLeaveCriticalSection(&ConsoleVDMCriticalSection); 01856 01857 if (Status != 0) { 01858 Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT; 01859 UnregisterVDM(Console); 01860 KdPrint(("CONSRV: VDM not responding. - second wait\n")); 01861 return Status; 01862 } 01863 ScreenInfo = Console->CurrentScreenBuffer; 01864 } 01865 01866 // set palette 01867 01868 if (ScreenInfo->hPalette != NULL) { 01869 SelectPalette(ScreenInfo->Console->hDC, 01870 ScreenInfo->hPalette, 01871 FALSE); 01872 SetActivePalette(ScreenInfo); 01873 } 01874 SetConsoleReserveKeys(Console->hWnd, CONSOLE_NOSHORTCUTKEY); 01875 HandleFocusEvent(Console,FALSE); 01876 01877 } 01878 01879 /* 01880 * Boost or lower the priority if we are going fullscreen or away. 01881 * 01882 * Note that console usually boosts and lowers its priority based 01883 * on WM_FOCUSS and WM_KILLFOCUS but when you switch to full screen 01884 * the implementation actually sends a WM_KILLFOCUS so we reboost the 01885 * correct console here. 01886 */ 01887 ModifyConsoleProcessFocus(Console, bForeground); 01888 01889 01890 #else 01891 UNREFERENCED_PARAMETER(bForeground); 01892 UNREFERENCED_PARAMETER(Console); 01893 UNREFERENCED_PARAMETER(ScreenInfo); 01894 #endif 01895 return STATUS_SUCCESS; 01896 }

NTSTATUS GetThreadConsoleDesktop DWORD  dwThreadId,
HDESK *  phdeskConsole
 

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

References CONSOLE_FROMTHREADPERPROCESSDATA, _CONSOLE_PER_PROCESS_DATA::ConsoleHandle, _CONSOLE_INFORMATION::hDesk, NT_SUCCESS, NTSTATUS(), NULL, PCONSOLE_PER_PROCESS_DATA, RevalidateConsole(), Status, and UnlockConsole().

Referenced by SrvGetThreadConsoleDesktop().

03142 { 03143 PCSR_THREAD pcsrt; 03144 PCONSOLE_PER_PROCESS_DATA ProcessData; 03145 PCONSOLE_INFORMATION Console; 03146 NTSTATUS Status; 03147 HANDLE ConsoleHandle = NULL; 03148 03149 *phdeskConsole = NULL; 03150 Status = CsrLockThreadByClientId((HANDLE)dwThreadId, &pcsrt); 03151 if (NT_SUCCESS(Status)) { 03152 ProcessData = CONSOLE_FROMTHREADPERPROCESSDATA(pcsrt); 03153 ConsoleHandle = ProcessData->ConsoleHandle; 03154 CsrUnlockThread(pcsrt); 03155 } 03156 03157 // 03158 // If this process is a console app, return the 03159 // handle to its desktop. Otherwise, return NULL. 03160 // 03161 03162 if (ConsoleHandle != NULL) { 03163 Status = RevalidateConsole(ConsoleHandle, &Console); 03164 if (NT_SUCCESS(Status)) { 03165 *phdeskConsole = Console->hDesk; 03166 } 03167 UnlockConsole(Console); 03168 } 03169 03170 return STATUS_SUCCESS; 03171 }

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 }

NTSTATUS MapViewOfSection PHANDLE  SectionHandle,
ULONG  CommitSize,
PVOID *  BaseAddress,
PSIZE_T  ViewSize,
HANDLE  ClientHandle,
PVOID *  BaseClientAddress
 

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

References L, NT_SUCCESS, NtClose(), NtCreateSection(), NtMapViewOfSection(), NTSTATUS(), NULL, and Status.

Referenced by SrvRegisterConsoleVDM().

01415 { 01416 01417 OBJECT_ATTRIBUTES Obja; 01418 NTSTATUS Status; 01419 LARGE_INTEGER secSize; 01420 01421 // 01422 // open section and map a view of it. 01423 // 01424 InitializeObjectAttributes( 01425 &Obja, 01426 NULL, 01427 OBJ_CASE_INSENSITIVE, 01428 NULL, 01429 NULL 01430 ); 01431 01432 secSize.QuadPart = CommitSize; 01433 Status = NtCreateSection (SectionHandle, 01434 SECTION_ALL_ACCESS, 01435 &Obja, 01436 &secSize, 01437 PAGE_READWRITE, 01438 SEC_RESERVE, 01439 NULL 01440 ); 01441 if (!NT_SUCCESS(Status)) { 01442 return((ULONG) Status); 01443 } 01444 01445 *BaseAddress = 0; 01446 *ViewSize = 0; 01447 01448 Status = NtMapViewOfSection(*SectionHandle, 01449 NtCurrentProcess(), 01450 BaseAddress, // Receives the base 01451 // address of the section. 01452 01453 0, // No specific type of 01454 // address required. 01455 01456 CommitSize, // Commit size. It was 01457 // passed by the caller. 01458 // NULL for a save, and 01459 // size of the section 01460 // for a set. 01461 01462 NULL, // Section offset it NULL; 01463 // Map from the start. 01464 01465 ViewSize, // View Size is NULL since 01466 // we want to map the 01467 // entire section. 01468 01469 ViewUnmap, 01470 0L, 01471 PAGE_READWRITE 01472 ); 01473 if (!NT_SUCCESS(Status)) { 01474 NtClose(*SectionHandle); 01475 return Status; 01476 } 01477 01478 *BaseClientAddress = 0; 01479 *ViewSize = 0; 01480 Status = NtMapViewOfSection(*SectionHandle, 01481 ClientHandle, 01482 BaseClientAddress, // Receives the base 01483 // address of the section. 01484 01485 0, // No specific type of 01486 // address required. 01487 01488 CommitSize, // Commit size. It was 01489 // passed by the caller. 01490 // NULL for a save, and 01491 // size of the section 01492 // for a set. 01493 01494 NULL, // Section offset it NULL; 01495 // Map from the start. 01496 01497 ViewSize, // View Size is NULL since 01498 // we want to map the 01499 // entire section. 01500 01501 ViewUnmap, 01502 // williamh, Jan 28 1994 01503 // This MEM_TOP_DOWN is necessary. 01504 // if the console has VDM registered, ntvdm would have released its video memory 01505 // address space(0xA0000 ~ 0xBFFFF). Without the MEM_TOP_DOWN, the 01506 // NtMapViewOfSection can grab the address space and we will have trouble of 01507 // mapping the address space to the physical video ram. We don't do a test 01508 // for VDM because there is no harm of doing this for non-vdm application. 01509 MEM_TOP_DOWN, 01510 PAGE_READWRITE 01511 ); 01512 if (!NT_SUCCESS(Status)) { 01513 NtClose(*SectionHandle); 01514 } 01515 return((ULONG) Status); 01516 }

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 SetRAMFont IN PSCREEN_INFORMATION  ScreenInfo,
IN PCHAR_INFO  ScreenBufPtr,
IN DWORD  Length
 

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

References tagSTRINGBITMAP::ajBits, BufferSize, BYTE, BYTE_ALIGN, CalcBitmapBufferSize(), ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, DWORD, FontInfo, _MODE_FONT_PAIR::FontSize, _FONT_CACHE_INFORMATION::FullScreenFontIndex, _FONT_CACHE_INFORMATION::FullScreenFontSize, GetExpandFontImage(), GetFontImage(), GetStringBitmapW(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, RegModeFontPairs, SetFontImage(), SHORT, Status, and WORD_ALIGN.

Referenced by FE_WriteRegionToScreenHW().

03341 { 03342 ULONG ModeIndex = ScreenInfo->BufferInfo.TextInfo.ModeIndex; 03343 COORD FsFontSize1 = RegModeFontPairs[ModeIndex].FontSize; 03344 COORD FsFontSize2 = FsFontSize1; 03345 COORD GdiFontSize1; 03346 COORD GdiFontSize2; 03347 COORD RetFontSize; 03348 WCHAR wCharBuf[2]; 03349 LPSTRINGBITMAP StringBitmap; 03350 DWORD BufferSize; 03351 PWORD FontImage; 03352 PFONT_CACHE_INFORMATION FontCache; 03353 HFONT hOldFont; 03354 NTSTATUS Status; 03355 03356 FontCache = (PFONT_CACHE_INFORMATION)ScreenInfo->Console->FontCacheInformation; 03357 if (FontCache==NULL) 03358 { 03359 RIPMSG0(RIP_ERROR, "SetRAMFont: ScreenInfo->Console->FontCacheInformation == NULL."); 03360 return STATUS_UNSUCCESSFUL; 03361 } 03362 03363 GdiFontSize1 = FontCache->FullScreenFontSize; 03364 GdiFontSize2 = GdiFontSize1; 03365 GdiFontSize2.X *= 2; 03366 FsFontSize2.X *= 2; 03367 03368 BufferSize = CalcBitmapBufferSize(GdiFontSize2,BYTE_ALIGN); 03369 StringBitmap = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03370 sizeof(STRINGBITMAP) + sizeof(StringBitmap->ajBits) * BufferSize); 03371 if (StringBitmap==NULL) 03372 { 03373 RIPMSG0(RIP_WARNING, "SetRAMFont: failed to allocate StringBitmap"); 03374 return STATUS_UNSUCCESSFUL; 03375 } 03376 03377 /* 03378 * Change GDI font to full screen font that best matched. 03379 */ 03380 hOldFont = SelectObject(ScreenInfo->Console->hDC,FontInfo[FontCache->FullScreenFontIndex].hFont); 03381 03382 while (Length--) 03383 { 03384 Status = GetFontImage(ScreenInfo->Console->FontCacheInformation, 03385 ScreenBufPtr->Char.UnicodeChar, 03386 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03387 0, 03388 NULL); 03389 if (! NT_SUCCESS(Status) ) 03390 { 03391 wCharBuf[0] = ScreenBufPtr->Char.UnicodeChar; 03392 wCharBuf[1] = TEXT('\0'); 03393 GetStringBitmapW(ScreenInfo->Console->hDC, 03394 wCharBuf, 03395 1, 03396 (ULONG)ConsoleHeapSize(StringBitmap), 03397 (BYTE*)StringBitmap 03398 ); 03399 03400 RetFontSize.X = (SHORT)StringBitmap->uiWidth; 03401 RetFontSize.Y = (SHORT)StringBitmap->uiHeight; 03402 03403 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03404 ScreenBufPtr->Char.UnicodeChar, 03405 RetFontSize, 03406 BYTE_ALIGN, 03407 StringBitmap->ajBits 03408 ); 03409 if (! NT_SUCCESS(Status)) { 03410 RIPMSG3(RIP_WARNING, "SetRAMFont: failed to set font image. wc=%04x sz=(%x,%x)", 03411 ScreenBufPtr->Char.UnicodeChar, RetFontSize.X, RetFontSize.Y); 03412 } 03413 03414 if ( ( (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) && 03415 (GdiFontSize2.X != FsFontSize2.X || GdiFontSize2.Y != FsFontSize2.Y)) || 03416 (!(ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) && 03417 (GdiFontSize1.X != FsFontSize1.X || GdiFontSize1.Y != FsFontSize1.Y)) ) 03418 { 03419 BufferSize = CalcBitmapBufferSize(FsFontSize2,WORD_ALIGN); 03420 FontImage = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03421 BufferSize 03422 ); 03423 if (FontImage!=NULL) { 03424 03425 GetExpandFontImage(ScreenInfo->Console->FontCacheInformation, 03426 ScreenBufPtr->Char.UnicodeChar, 03427 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? GdiFontSize2 : GdiFontSize1, 03428 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03429 FontImage 03430 ); 03431 03432 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03433 ScreenBufPtr->Char.UnicodeChar, 03434 (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1, 03435 WORD_ALIGN, 03436 FontImage 03437 ); 03438 if (! NT_SUCCESS(Status)) { 03439 RIPMSG3(RIP_WARNING, "SetRAMFont: failed to set font image. wc=%04x sz=(%x,%x)", 03440 ScreenBufPtr->Char.UnicodeChar, 03441 ((ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1).X, 03442 ((ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) ? FsFontSize2 : FsFontSize1).Y); 03443 } 03444 03445 ConsoleHeapFree(FontImage); 03446 } else { 03447 RIPMSG0(RIP_WARNING, "SetRAMFont: failed to allocate FontImage."); 03448 } 03449 } 03450 } 03451 03452 if (ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS) 03453 { 03454 ScreenBufPtr += 2; 03455 if (Length >= 1) 03456 Length -= 1; 03457 else 03458 break; 03459 } 03460 else 03461 { 03462 ScreenBufPtr++; 03463 } 03464 } 03465 03466 ConsoleHeapFree(StringBitmap); 03467 03468 /* 03469 * Back to GDI font 03470 */ 03471 SelectObject(ScreenInfo->Console->hDC,hOldFont); 03472 03473 return Status; 03474 }

NTSTATUS SetRAMFontCodePage IN PSCREEN_INFORMATION  ScreenInfo  ) 
 

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

References tagSTRINGBITMAP::ajBits, BufferSize, BYTE, BYTE_ALIGN, CalcBitmapBufferSize(), ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, CreateFontCache(), DWORD, FontInfo, _MODE_FONT_PAIR::FontSize, _FONT_CACHE_INFORMATION::FullScreenFontIndex, _FONT_CACHE_INFORMATION::FullScreenFontSize, GetExpandFontImage(), GetStringBitmapW(), LPSTRINGBITMAP, MAKE_TAG, MakeAltRasterFont(), NT_SUCCESS, NTSTATUS(), NULL, OEMCP, PFONT_CACHE_INFORMATION, RegModeFontPairs, SCR_FONTCODEPAGE(), _MODE_FONT_PAIR::ScreenSize, SetFontImage(), SHORT, Status, STRINGBITMAP, and WORD_ALIGN.

Referenced by FE_WriteRegionToScreenHW().

03178 { 03179 FSVIDEO_SCREEN_INFORMATION ScreenInformation; 03180 ULONG ModeIndex = ScreenInfo->BufferInfo.TextInfo.ModeIndex; 03181 COORD FontSize; 03182 WCHAR wChar; 03183 WCHAR wCharBuf[2]; 03184 LPSTRINGBITMAP StringBitmap; 03185 DWORD BufferSize; 03186 PWORD FontImage; 03187 PFONT_CACHE_INFORMATION FontCache; 03188 WCHAR AltFaceName[LF_FACESIZE]; 03189 COORD AltFontSize; 03190 BYTE AltFontFamily; 03191 ULONG AltFontIndex = 0; 03192 HFONT hOldFont; 03193 NTSTATUS Status; 03194 03195 ScreenInformation.ScreenSize = RegModeFontPairs[ModeIndex].ScreenSize; 03196 ScreenInformation.FontSize = RegModeFontPairs[ModeIndex].FontSize; 03197 if (ScreenInfo->Console->FontCacheInformation == NULL) 03198 { 03199 Status = CreateFontCache(&FontCache); 03200 if (!NT_SUCCESS(Status)) { 03201 RIPMSG1(RIP_WARNING, "SetRAMFontCodePage: failed in CreateFontCache. Status=%08x", Status); 03202 return STATUS_UNSUCCESSFUL; 03203 } 03204 (PFONT_CACHE_INFORMATION)ScreenInfo->Console->FontCacheInformation = FontCache; 03205 03206 MakeAltRasterFont(SCR_FONTCODEPAGE(ScreenInfo), 03207 RegModeFontPairs[ModeIndex].FontSize, 03208 &AltFontSize, &AltFontFamily, &AltFontIndex, AltFaceName); 03209 FontCache->FullScreenFontIndex = AltFontIndex; 03210 FontCache->FullScreenFontSize = AltFontSize; 03211 03212 BufferSize = CalcBitmapBufferSize(FontCache->FullScreenFontSize,BYTE_ALIGN); 03213 StringBitmap = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03214 sizeof(STRINGBITMAP) + sizeof(StringBitmap->ajBits) * BufferSize); 03215 if (StringBitmap==NULL) 03216 { 03217 RIPMSG0(RIP_WARNING, "SetRAMFontCodePage: failed to allocate StringBitmap"); 03218 return STATUS_UNSUCCESSFUL; 03219 } 03220 03221 03222 /* 03223 * Change GDI font to full screen font that best matched. 03224 */ 03225 hOldFont = SelectObject(ScreenInfo->Console->hDC,FontInfo[FontCache->FullScreenFontIndex].hFont); 03226 03227 03228 for (wChar=0x00; wChar < 0x80; wChar++) { 03229 wCharBuf[0] = wChar; 03230 wCharBuf[1] = TEXT('\0'); 03231 GetStringBitmapW(ScreenInfo->Console->hDC, 03232 wCharBuf, 03233 1, 03234 (ULONG)ConsoleHeapSize(StringBitmap), 03235 (BYTE*)StringBitmap 03236 ); 03237 03238 FontSize.X = (SHORT)StringBitmap->uiWidth; 03239 FontSize.Y = (SHORT)StringBitmap->uiHeight; 03240 03241 #if defined(LATER_DBCS_FOR_GRID_CHAR) // by kazum 03242 BufferSize = CalcBitmapBufferSize(FontSize,BYTE_ALIGN); 03243 *(StringBitmap->ajBits + BufferSize) = 0; 03244 *(StringBitmap->ajBits + BufferSize + 1) = 0; 03245 03246 if (gpGridCharacter) { 03247 PGRID_CHARACTER_INFORMATION GridCharacter; 03248 PWCHAR CodePoint; 03249 03250 GridCharacter = gpGridCharacter; 03251 do { 03252 if (GridCharacter->CodePage == OEMCP) { 03253 CodePoint = GridCharacter->CodePoint; 03254 while (*CodePoint) { 03255 if (*CodePoint == wChar) { 03256 if (FontSize.X <= 8) 03257 *(StringBitmap->ajBits + BufferSize) = *(StringBitmap->ajBits + BufferSize - 1); 03258 else { 03259 *(StringBitmap->ajBits + BufferSize) = *(StringBitmap->ajBits + BufferSize - 2); 03260 *(StringBitmap->ajBits + BufferSize + 1) = *(StringBitmap->ajBits + BufferSize - 1); 03261 } 03262 break; 03263 } 03264 else 03265 CodePoint++; 03266 } 03267 break; 03268 } 03269 } while (GridCharacter = GridCharacter->pNext); 03270 } 03271 #endif // LATER_DBCS_FOR_GRID_CHAR // by kazum 03272 03273 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03274 wChar, 03275 FontSize, 03276 BYTE_ALIGN, 03277 StringBitmap->ajBits 03278 ); 03279 if (! NT_SUCCESS(Status)) { 03280 RIPMSG3(RIP_WARNING, "SetRAMFontCodePage: failed to set font image. wc=%04x sz=(%x, %x).", 03281 wChar, FontSize.X, FontSize.Y); 03282 } 03283 03284 if (FontSize.X != ScreenInformation.FontSize.X || 03285 FontSize.Y != ScreenInformation.FontSize.Y) 03286 { 03287 BufferSize = CalcBitmapBufferSize(ScreenInformation.FontSize,WORD_ALIGN); 03288 FontImage = ConsoleHeapAlloc( MAKE_TAG(TMP_DBCS_TAG), 03289 BufferSize 03290 ); 03291 if (FontImage!=NULL) { 03292 03293 GetExpandFontImage(ScreenInfo->Console->FontCacheInformation, 03294 wChar, 03295 FontSize, 03296 ScreenInformation.FontSize, 03297 FontImage 03298 ); 03299 03300 Status = SetFontImage(ScreenInfo->Console->FontCacheInformation, 03301 wChar, 03302 ScreenInformation.FontSize, 03303 WORD_ALIGN, 03304 FontImage 03305 ); 03306 if (! NT_SUCCESS(Status)) { 03307 RIPMSG3(RIP_WARNING, "SetRAMFontCodePage: failed to set font image. wc=%04x, sz=(%x,%x)", 03308 wChar, ScreenInformation.FontSize.X, ScreenInformation.FontSize.Y); 03309 } 03310 03311 ConsoleHeapFree(FontImage); 03312 } else { 03313 RIPMSG0(RIP_WARNING, "SetRAMFontCodePage: failed to allocate FontImage."); 03314 } 03315 } 03316 } 03317 03318 ConsoleHeapFree(StringBitmap); 03319 03320 /* 03321 * Back to GDI font 03322 */ 03323 SelectObject(ScreenInfo->Console->hDC,hOldFont); 03324 } 03325 03326 Status = GdiFullscreenControl(FullscreenControlSetScreenInformation, 03327 &ScreenInformation, 03328 sizeof(ScreenInformation), 03329 NULL, 03330 NULL); 03331 03332 return Status; 03333 }

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 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 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(), _MODE_FONT_PAIR::FontSize, _CONSOLE_GETHARDWARESTATE_MSG::FontSize, ModeFontPairs, NT_SUCCESS, NTSTATUS(), _CONSOLE_GETHARDWARESTATE_MSG::OutputHandle, RegModeFontPairs, _MODE_FONT_PAIR::Resolution, _CONSOLE_GETHARDWARESTATE_MSG::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 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, _SCREEN_INFORMATION::Flags, _CONSOLE_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_REGISTERVDM_MSG::StateBuffer, _CONSOLE_INFORMATION::StateBuffer, _CONSOLE_INFORMATION::StateBufferClient, _CONSOLE_INFORMATION::StateLength, _CONSOLE_REGISTERVDM_MSG::StateLength, _CONSOLE_INFORMATION::StateSectionHandle, _CONSOLE_REGISTERVDM_MSG::StateSectionName, _CONSOLE_REGISTERVDM_MSG::StateSectionNameLength, Status, _INPUT_THREAD_INFO::ThreadHandle, TIF_VDMAPP, TRUE, UnlockConsole(), UnregisterVDM(), _CONSOLE_REGISTERVDM_MSG::VDMBuffer, _CONSOLE_INFORMATION::VDMBuffer, _CONSOLE_INFORMATION::VDMBufferClient, _CONSOLE_INFORMATION::VDMBufferSectionHandle, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionName, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionNameLength, _CONSOLE_INFORMATION::VDMBufferSize, _CONSOLE_REGISTERVDM_MSG::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 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 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 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, _MODE_FONT_PAIR::FontSize, _CONSOLE_SETHARDWARESTATE_MSG::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, _MODE_FONT_PAIR::Resolution, _CONSOLE_SETHARDWARESTATE_MSG::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 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_SETKEYSHORTCUTS_MSG::ReserveKeys, _CONSOLE_INFORMATION::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 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 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 }

VOID UnregisterVDM IN PCONSOLE_INFORMATION  Console  ) 
 

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

References AdjustCursorPosition, ASSERT, BOOL, ConnectToEmulator(), CONSOLE_CONNECTED_TO_EMULATOR, CONSOLE_HAS_FOCUS, CONSOLE_TEXTMODE_BUFFER, CONSOLE_VDM_REGISTERED, CONSOLE_WOW_REGISTERED, FALSE, FS_MODE_GRAPHICS, FullScreenInitialized, Index, IsAvailableFsCodePage(), JAPAN_CP, KOREAN_CP, _MODE_FONT_PAIR::Mode, NtClose(), NtUnmapViewOfSection(), NtUserConsoleControl(), NtUserSetInformationThread(), NULL, RegModeFontPairs, _MODE_FONT_PAIR::Resolution, TIF_DOSEMULATOR, TIF_VDMAPP, and TRUE.

Referenced by DisplayModeTransition(), RemoveConsole(), and SrvRegisterConsoleVDM().

00983 { 00984 // williamh, Feb 2 1994. 00985 // catch multiple calls to unregister vdm. Believe it or not, this could 00986 // happen 00987 ASSERT(Console->Flags & CONSOLE_VDM_REGISTERED); 00988 if (!(Console->Flags & CONSOLE_VDM_REGISTERED)) 00989 return; 00990 00991 #if defined(FE_SB) && defined(i386) 00992 // When HDOS apps exit, console screen resolution is changed to 640*400. Because HBIOS set 00993 // Screen resolution to 640*400. So, we should replace current screen resoultion(640*480). 00994 // 09/11/96 bklee 00995 { 00996 00997 if ((Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE) && 00998 ( Console->OutputCP == KOREAN_CP || 00999 (Console->OutputCP == JAPAN_CP && ISNECPC98(gdwMachineId) ) )) { 01000 01001 ULONG Index; 01002 DEVMODEW Devmode; 01003 BOOL fGraphics = fFullScreenGraphics ? IsAvailableFsCodePage(Console->OutputCP) : FALSE; 01004 01005 Index = Console->CurrentScreenBuffer->BufferInfo.TextInfo.ModeIndex; 01006 01007 ZeroMemory(&Devmode, sizeof(Devmode)); 01008 01009 Devmode.dmSize = sizeof(Devmode); 01010 Devmode.dmDriverExtra = 0; 01011 Devmode.dmFields = DM_BITSPERPEL | 01012 DM_PELSWIDTH | 01013 DM_PELSHEIGHT | 01014 DM_DISPLAYFLAGS; 01015 01016 Devmode.dmBitsPerPel = 4; 01017 01018 Devmode.dmPelsWidth = RegModeFontPairs[Index].Resolution.X; 01019 Devmode.dmPelsHeight = RegModeFontPairs[Index].Resolution.Y; 01020 Devmode.dmDisplayFlags = (fGraphics && (RegModeFontPairs[Index].Mode & FS_MODE_GRAPHICS)) ? 0 : DMDISPLAYFLAGS_TEXTMODE; 01021 01022 GdiFullscreenControl(FullscreenControlSetMode, 01023 &Devmode, 01024 sizeof(Devmode), 01025 NULL, 01026 NULL); 01027 } 01028 } 01029 #endif 01030 #ifdef i386 01031 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE && 01032 Console->Flags & CONSOLE_CONNECTED_TO_EMULATOR) { 01033 NtUserConsoleControl(ConsoleSetVDMCursorBounds, NULL, 0); 01034 // connect emulator 01035 ConnectToEmulator(FALSE, Console); 01036 } 01037 01038 if (FullScreenInitialized) { 01039 CloseHandle(Console->VDMStartHardwareEvent); 01040 CloseHandle(Console->VDMEndHardwareEvent); 01041 NtUnmapViewOfSection(NtCurrentProcess(),Console->StateBuffer); 01042 NtUnmapViewOfSection(Console->VDMProcessHandle,Console->StateBufferClient); 01043 NtClose(Console->StateSectionHandle); 01044 Console->StateLength = 0; 01045 } 01046 01047 #endif 01048 01049 Console->Flags &= ~CONSOLE_VDM_REGISTERED; 01050 01051 if (Console->Flags & CONSOLE_HAS_FOCUS) { 01052 USERTHREAD_FLAGS Flags; 01053 01054 Flags.dwFlags = 0; 01055 Flags.dwMask = (TIF_VDMAPP | TIF_DOSEMULATOR); 01056 NtUserSetInformationThread(Console->InputThreadInfo->ThreadHandle, 01057 UserThreadFlags, &Flags, sizeof(Flags)); 01058 } 01059 Console->Flags &= ~CONSOLE_WOW_REGISTERED; 01060 ASSERT(Console->VDMBuffer != NULL); 01061 if (Console->VDMBuffer != NULL) { 01062 NtUnmapViewOfSection(Console->VDMProcessHandle,Console->VDMBufferClient); 01063 NtUnmapViewOfSection(NtCurrentProcess(),Console->VDMBuffer); 01064 NtClose(Console->VDMBufferSectionHandle); 01065 Console->VDMBuffer = NULL; 01066 } 01067 #ifdef i386 01068 if (Console->CurrentScreenBuffer && 01069 Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 01070 Console->CurrentScreenBuffer->BufferInfo.TextInfo.MousePosition.X = 0; 01071 Console->CurrentScreenBuffer->BufferInfo.TextInfo.MousePosition.Y = 0; 01072 } 01073 #endif 01074 ASSERT(Console->VDMProcessHandle); 01075 CloseHandle(Console->VDMProcessHandle); 01076 Console->VDMProcessHandle = NULL; 01077 01078 #if defined(FE_SB) && defined(FE_IME) && defined(i386) 01079 { 01080 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 01081 Console->Flags |= CONSOLE_JUST_VDM_UNREGISTERED ; 01082 } 01083 else if (Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER) { 01084 AdjustCursorPosition(Console->CurrentScreenBuffer, 01085 Console->CurrentScreenBuffer->BufferInfo.TextInfo.CursorPosition, 01086 TRUE, 01087 NULL); 01088 } 01089 } 01090 #endif 01091 }

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 }


Variable Documentation

UCHAR ColorBuffer[]
 

Initial value:

{ 16, 0, 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x2A, 0x2A, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x2A, 0x00, 0x2A, 0x2A, 0x00, 0x00, 0x36, 0x36, 0x36, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x3F, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x00 }

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

HANDLE hCPIFile
 

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

Referenced by InitializeFullScreen().

USHORT InitialPalette[INITIAL_PALETTE_SIZE]
 

Initial value:

{ 16, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }

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

MODE_FONT_PAIR ModeFontPairs[NUMBER_OF_MODE_FONT_PAIRS]
 

Initial value:

{ {21, 640, 350, 8, 16}, {25, 720, 400, 8, 16}, {28, 720, 400, 8, 14}, {43, 640, 350, 8, 8 }, {50, 720, 400, 8, 8 } }

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

Referenced by DisplayModeTransition(), SrvGetConsoleHardwareState(), and SrvSetConsoleHardwareState().


Generated on Sat May 15 19:45:18 2004 for test by doxygen 1.3.7