mirror of
https://github.com/reactos/reactos.git
synced 2024-07-31 08:39:05 +00:00
Second partial merge of the condrv_restructure branch, including additions from revisions 63818, 63819, 63820 and 63831.
CORE-7931 #comment Second partial merge of the condrv_restructure branch in revision 63834. svn path=/trunk/; revision=63834
This commit is contained in:
parent
9665943699
commit
fe54ef7132
|
@ -115,7 +115,8 @@ InitConsoleDefaults(PCONSOLE_PROPS pConInfo)
|
||||||
wcsncpy(GuiInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
|
wcsncpy(GuiInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
|
||||||
// GuiInfo->FaceName[0] = L'\0';
|
// GuiInfo->FaceName[0] = L'\0';
|
||||||
GuiInfo->FontFamily = FF_DONTCARE;
|
GuiInfo->FontFamily = FF_DONTCARE;
|
||||||
GuiInfo->FontSize = 0;
|
GuiInfo->FontSize.X = 0;
|
||||||
|
GuiInfo->FontSize.Y = 0;
|
||||||
GuiInfo->FontWeight = FW_DONTCARE;
|
GuiInfo->FontWeight = FW_DONTCARE;
|
||||||
GuiInfo->UseRasterFonts = TRUE;
|
GuiInfo->UseRasterFonts = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -120,8 +120,8 @@ PaintText(LPDRAWITEMSTRUCT drawItem,
|
||||||
hBrush = CreateSolidBrush(nbkColor);
|
hBrush = CreateSolidBrush(nbkColor);
|
||||||
if (!hBrush) return FALSE;
|
if (!hBrush) return FALSE;
|
||||||
|
|
||||||
Font = CreateFontW(LOWORD(GuiInfo->FontSize),
|
Font = CreateFontW(GuiInfo->FontSize.X,
|
||||||
0, // HIWORD(GuiInfo->FontSize),
|
0, // GuiInfo->FontSize.Y,
|
||||||
0,
|
0,
|
||||||
TA_BASELINE,
|
TA_BASELINE,
|
||||||
GuiInfo->FontWeight,
|
GuiInfo->FontWeight,
|
||||||
|
|
|
@ -1076,24 +1076,37 @@ BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
FreeConsole(VOID)
|
FreeConsole(VOID)
|
||||||
{
|
{
|
||||||
// AG: I'm not sure if this is correct (what happens to std handles?)
|
|
||||||
// but I just tried to reverse what AllocConsole() does...
|
|
||||||
|
|
||||||
NTSTATUS Status;
|
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
|
PCONSOLE_FREECONSOLE FreeConsoleRequest = &ApiMessage.Data.FreeConsoleRequest;
|
||||||
|
HANDLE ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
|
||||||
|
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
/* We must have a non-trivial handle to close */
|
||||||
NULL,
|
if (ConsoleHandle == NULL) // IsConsoleHandle(ConsoleHandle)
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFree),
|
|
||||||
sizeof(CONSOLE_FREECONSOLE));
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
BaseSetLastNTError(Status);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set up the data to send to the Console Server */
|
||||||
|
FreeConsoleRequest->ConsoleHandle = ConsoleHandle;
|
||||||
|
|
||||||
|
/* Call the server */
|
||||||
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
|
NULL,
|
||||||
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFree),
|
||||||
|
sizeof(*FreeConsoleRequest));
|
||||||
|
|
||||||
|
/* Check for success */
|
||||||
|
if (!NT_SUCCESS(ApiMessage.Status))
|
||||||
|
{
|
||||||
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reset the console handle */
|
||||||
NtCurrentPeb()->ProcessParameters->ConsoleHandle = NULL;
|
NtCurrentPeb()->ProcessParameters->ConsoleHandle = NULL;
|
||||||
|
|
||||||
|
/* Close the associated input handle */
|
||||||
CloseHandle(InputWaitHandle);
|
CloseHandle(InputWaitHandle);
|
||||||
InputWaitHandle = INVALID_HANDLE_VALUE;
|
InputWaitHandle = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
|
@ -1311,7 +1324,7 @@ GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
|
||||||
BaseSetLastNTError(ApiMessage.Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("GetLargestConsoleWindowSize, X = %d, Y = %d\n", GetLargestWindowSizeRequest->Size.X, GetLargestWindowSizeRequest->Size.Y);
|
DPRINT("GetLargestConsoleWindowSize, X = %d, Y = %d\n", GetLargestWindowSizeRequest->Size.X, GetLargestWindowSizeRequest->Size.Y);
|
||||||
return GetLargestWindowSizeRequest->Size;
|
return GetLargestWindowSizeRequest->Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2602,22 +2615,67 @@ UnregisterConsoleIME(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
BOOL
|
||||||
* @unimplemented
|
IntGetConsoleKeyboardLayoutName(OUT PVOID pszLayoutName,
|
||||||
*/
|
IN BOOL bAnsi)
|
||||||
BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name)
|
|
||||||
{
|
{
|
||||||
STUB;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
return 0;
|
PCONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest = &ApiMessage.Data.GetKbdLayoutNameRequest;
|
||||||
|
|
||||||
|
/* Set up the data to send to the Console Server */
|
||||||
|
GetKbdLayoutNameRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
|
||||||
|
GetKbdLayoutNameRequest->Ansi = bAnsi;
|
||||||
|
|
||||||
|
/* Call the server */
|
||||||
|
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
|
NULL,
|
||||||
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetKeyboardLayoutName),
|
||||||
|
sizeof(*GetKbdLayoutNameRequest));
|
||||||
|
|
||||||
|
/* Check for success */
|
||||||
|
if (!NT_SUCCESS(ApiMessage.Status))
|
||||||
|
{
|
||||||
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieve the results */
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
/* Copy only KL_NAMELENGTH == 9 characters, ANSI or UNICODE */
|
||||||
|
if (bAnsi)
|
||||||
|
strncpy(pszLayoutName, (PCHAR)GetKbdLayoutNameRequest->LayoutBuffer, KL_NAMELENGTH);
|
||||||
|
else
|
||||||
|
wcsncpy(pszLayoutName, (PWCHAR)GetKbdLayoutNameRequest->LayoutBuffer, KL_NAMELENGTH);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_ACCESS);
|
||||||
|
_SEH2_YIELD(return FALSE);
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented (undocumented)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name)
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
GetConsoleKeyboardLayoutNameA(OUT LPSTR pszLayoutName)
|
||||||
{
|
{
|
||||||
STUB;
|
return IntGetConsoleKeyboardLayoutName(pszLayoutName, TRUE);
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented (undocumented)
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
GetConsoleKeyboardLayoutNameW(OUT LPWSTR pszLayoutName)
|
||||||
|
{
|
||||||
|
return IntGetConsoleKeyboardLayoutName(pszLayoutName, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -399,7 +399,7 @@ IntReadConsoleOutput(IN HANDLE hConsoleOutput,
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
NumCells = SizeX * SizeY;
|
NumCells = SizeX * SizeY;
|
||||||
DPRINT1("IntReadConsoleOutput: (%d x %d)\n", SizeX, SizeY);
|
DPRINT("IntReadConsoleOutput: (%d x %d)\n", SizeX, SizeY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For optimization purposes, Windows (and hence ReactOS, too, for
|
* For optimization purposes, Windows (and hence ReactOS, too, for
|
||||||
|
@ -869,7 +869,7 @@ IntWriteConsoleOutput(IN HANDLE hConsoleOutput,
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
NumCells = SizeX * SizeY;
|
NumCells = SizeX * SizeY;
|
||||||
DPRINT1("IntWriteConsoleOutput: (%d x %d)\n", SizeX, SizeY);
|
DPRINT("IntWriteConsoleOutput: (%d x %d)\n", SizeX, SizeY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For optimization purposes, Windows (and hence ReactOS, too, for
|
* For optimization purposes, Windows (and hence ReactOS, too, for
|
||||||
|
|
|
@ -164,6 +164,7 @@ typedef struct _CONSOLE_START_INFO
|
||||||
DWORD dwHotKey;
|
DWORD dwHotKey;
|
||||||
DWORD dwStartupFlags;
|
DWORD dwStartupFlags;
|
||||||
CONSOLE_PROPERTIES;
|
CONSOLE_PROPERTIES;
|
||||||
|
|
||||||
BOOLEAN ConsoleNeeded; // Used for GUI apps only.
|
BOOLEAN ConsoleNeeded; // Used for GUI apps only.
|
||||||
LPTHREAD_START_ROUTINE CtrlDispatcher;
|
LPTHREAD_START_ROUTINE CtrlDispatcher;
|
||||||
LPTHREAD_START_ROUTINE ImeDispatcher;
|
LPTHREAD_START_ROUTINE ImeDispatcher;
|
||||||
|
@ -281,7 +282,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ULONG Dummy;
|
HANDLE ConsoleHandle;
|
||||||
} CONSOLE_FREECONSOLE, *PCONSOLE_FREECONSOLE;
|
} CONSOLE_FREECONSOLE, *PCONSOLE_FREECONSOLE;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -793,6 +794,13 @@ typedef struct
|
||||||
HANDLE EventHandle;
|
HANDLE EventHandle;
|
||||||
} CONSOLE_SETINPUTOUTPUTCP, *PCONSOLE_SETINPUTOUTPUTCP;
|
} CONSOLE_SETINPUTOUTPUTCP, *PCONSOLE_SETINPUTOUTPUTCP;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
HANDLE ConsoleHandle;
|
||||||
|
CHAR LayoutBuffer[KL_NAMELENGTH * sizeof(WCHAR)]; // Can hold up to 9 wchars
|
||||||
|
BOOL Ansi;
|
||||||
|
} CONSOLE_GETKBDLAYOUTNAME, *PCONSOLE_GETKBDLAYOUTNAME;
|
||||||
|
|
||||||
typedef struct _CONSOLE_API_MESSAGE
|
typedef struct _CONSOLE_API_MESSAGE
|
||||||
{
|
{
|
||||||
PORT_MESSAGE Header;
|
PORT_MESSAGE Header;
|
||||||
|
@ -886,9 +894,10 @@ typedef struct _CONSOLE_API_MESSAGE
|
||||||
CONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest;
|
CONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest;
|
||||||
CONSOLE_SETHISTORYMODE SetHistoryModeRequest;
|
CONSOLE_SETHISTORYMODE SetHistoryModeRequest;
|
||||||
|
|
||||||
/* Input and Output Code Pages */
|
/* Input and Output Code Pages; keyboard */
|
||||||
CONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest;
|
CONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest;
|
||||||
CONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest;
|
CONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest;
|
||||||
|
CONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest;
|
||||||
} Data;
|
} Data;
|
||||||
} CONSOLE_API_MESSAGE, *PCONSOLE_API_MESSAGE;
|
} CONSOLE_API_MESSAGE, *PCONSOLE_API_MESSAGE;
|
||||||
|
|
||||||
|
|
|
@ -999,8 +999,21 @@ CSR_API(SrvSetConsoleKeyShortcuts)
|
||||||
|
|
||||||
CSR_API(SrvGetConsoleKeyboardLayoutName)
|
CSR_API(SrvGetConsoleKeyboardLayoutName)
|
||||||
{
|
{
|
||||||
DPRINT1("%s not yet implemented\n", __FUNCTION__);
|
NTSTATUS Status;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
PCONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetKbdLayoutNameRequest;
|
||||||
|
PCONSOLE Console;
|
||||||
|
|
||||||
|
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
/* Retrieve the keyboard layout name of the system */
|
||||||
|
if (GetKbdLayoutNameRequest->Ansi)
|
||||||
|
GetKeyboardLayoutNameA((PCHAR)GetKbdLayoutNameRequest->LayoutBuffer);
|
||||||
|
else
|
||||||
|
GetKeyboardLayoutNameW((PWCHAR)GetKbdLayoutNameRequest->LayoutBuffer);
|
||||||
|
|
||||||
|
ConSrvReleaseConsole(Console, TRUE);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(SrvGetConsoleCharType)
|
CSR_API(SrvGetConsoleCharType)
|
||||||
|
|
|
@ -506,8 +506,8 @@ OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
|
||||||
|
|
||||||
GuiData->hWindow = hWnd;
|
GuiData->hWindow = hWnd;
|
||||||
|
|
||||||
GuiData->Font = CreateFontW(LOWORD(GuiData->GuiInfo.FontSize),
|
GuiData->Font = CreateFontW(GuiData->GuiInfo.FontSize.X,
|
||||||
0, // HIWORD(GuiData->GuiInfo.FontSize),
|
0, // GuiData->GuiInfo.FontSize.Y,
|
||||||
0,
|
0,
|
||||||
TA_BASELINE,
|
TA_BASELINE,
|
||||||
GuiData->GuiInfo.FontWeight,
|
GuiData->GuiInfo.FontWeight,
|
||||||
|
@ -2321,6 +2321,19 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undocumented message sent by Windows' console.dll for applying console info.
|
||||||
|
* See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
|
||||||
|
* and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
case WM_SETCONSOLEINFO:
|
||||||
|
{
|
||||||
|
DPRINT1("WM_SETCONSOLEINFO message\n");
|
||||||
|
GuiApplyWindowsConsoleSettings(GuiData, (HANDLE)wParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PM_CONSOLE_BEEP:
|
case PM_CONSOLE_BEEP:
|
||||||
DPRINT1("Beep !!\n");
|
DPRINT1("Beep !!\n");
|
||||||
Beep(800, 200);
|
Beep(800, 200);
|
||||||
|
|
|
@ -98,7 +98,8 @@ GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"FontSize"))
|
else if (!wcscmp(szValueName, L"FontSize"))
|
||||||
{
|
{
|
||||||
TermInfo->FontSize = Value;
|
TermInfo->FontSize.X = LOWORD(Value);
|
||||||
|
TermInfo->FontSize.Y = HIWORD(Value);
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"FontWeight"))
|
else if (!wcscmp(szValueName, L"FontWeight"))
|
||||||
|
@ -159,7 +160,10 @@ do {
|
||||||
|
|
||||||
SetConsoleSetting(L"FaceName", REG_SZ, (wcslen(TermInfo->FaceName) + 1) * sizeof(WCHAR), TermInfo->FaceName, L'\0'); // wcsnlen
|
SetConsoleSetting(L"FaceName", REG_SZ, (wcslen(TermInfo->FaceName) + 1) * sizeof(WCHAR), TermInfo->FaceName, L'\0'); // wcsnlen
|
||||||
SetConsoleSetting(L"FontFamily", REG_DWORD, sizeof(DWORD), &TermInfo->FontFamily, FF_DONTCARE);
|
SetConsoleSetting(L"FontFamily", REG_DWORD, sizeof(DWORD), &TermInfo->FontFamily, FF_DONTCARE);
|
||||||
SetConsoleSetting(L"FontSize", REG_DWORD, sizeof(DWORD), &TermInfo->FontSize, 0);
|
|
||||||
|
Storage = MAKELONG(TermInfo->FontSize.X, TermInfo->FontSize.Y);
|
||||||
|
SetConsoleSetting(L"FontSize", REG_DWORD, sizeof(DWORD), &Storage, 0);
|
||||||
|
|
||||||
SetConsoleSetting(L"FontWeight", REG_DWORD, sizeof(DWORD), &TermInfo->FontWeight, FW_DONTCARE);
|
SetConsoleSetting(L"FontWeight", REG_DWORD, sizeof(DWORD), &TermInfo->FontWeight, FW_DONTCARE);
|
||||||
|
|
||||||
Storage = TermInfo->FullScreen;
|
Storage = TermInfo->FullScreen;
|
||||||
|
@ -200,7 +204,8 @@ GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo,
|
||||||
wcsncpy(TermInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
|
wcsncpy(TermInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !!
|
||||||
// TermInfo->FaceName[0] = L'\0';
|
// TermInfo->FaceName[0] = L'\0';
|
||||||
TermInfo->FontFamily = FF_DONTCARE;
|
TermInfo->FontFamily = FF_DONTCARE;
|
||||||
TermInfo->FontSize = 0;
|
TermInfo->FontSize.X = 0;
|
||||||
|
TermInfo->FontSize.Y = 0;
|
||||||
TermInfo->FontWeight = FW_DONTCARE;
|
TermInfo->FontWeight = FW_DONTCARE;
|
||||||
TermInfo->UseRasterFonts = TRUE;
|
TermInfo->UseRasterFonts = TRUE;
|
||||||
|
|
||||||
|
@ -544,4 +549,180 @@ Quit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function for dealing with the undocumented message and structure used by
|
||||||
|
* Windows' console.dll for setting console info.
|
||||||
|
* See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
|
||||||
|
* and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
|
||||||
|
HANDLE hClientSection)
|
||||||
|
{
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
PCONSOLE Console = GuiData->Console;
|
||||||
|
PCONSOLE_PROCESS_DATA ProcessData;
|
||||||
|
HANDLE hSection = NULL;
|
||||||
|
ULONG ViewSize = 0;
|
||||||
|
PCONSOLE_STATE_INFO pConInfo = NULL;
|
||||||
|
CONSOLE_INFO ConInfo;
|
||||||
|
GUI_CONSOLE_INFO GuiInfo;
|
||||||
|
SIZE_T Length;
|
||||||
|
|
||||||
|
if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return;
|
||||||
|
|
||||||
|
/* Get the console leader process, our client */
|
||||||
|
ProcessData = ConSrvGetConsoleLeaderProcess(Console);
|
||||||
|
|
||||||
|
/* Duplicate the section handle for ourselves */
|
||||||
|
Status = NtDuplicateObject(ProcessData->Process->ProcessHandle,
|
||||||
|
hClientSection,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
&hSection,
|
||||||
|
0, 0, DUPLICATE_SAME_ACCESS);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Error when mapping client handle, Status = %lu\n", Status);
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get a view of the shared section */
|
||||||
|
Status = NtMapViewOfSection(hSection,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
(PVOID*)&pConInfo,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
&ViewSize,
|
||||||
|
ViewUnmap,
|
||||||
|
0,
|
||||||
|
PAGE_READWRITE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Error when mapping view of file, Status = %lu\n", Status);
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
/* Check that the section is well-sized */
|
||||||
|
if ( (ViewSize < sizeof(CONSOLE_STATE_INFO)) ||
|
||||||
|
(pConInfo->cbSize != sizeof(CONSOLE_STATE_INFO)) )
|
||||||
|
{
|
||||||
|
DPRINT1("Error: section bad-sized: sizeof(Section) < sizeof(CONSOLE_STATE_INFO)\n");
|
||||||
|
Status = STATUS_INVALID_VIEW_SIZE;
|
||||||
|
_SEH2_YIELD(goto Quit);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Check that GuiData->hWindow == pConInfo->hConsoleWindow
|
||||||
|
|
||||||
|
/* Retrieve terminal informations */
|
||||||
|
|
||||||
|
// Console information
|
||||||
|
ConInfo.HistoryBufferSize = pConInfo->HistoryBufferSize;
|
||||||
|
ConInfo.NumberOfHistoryBuffers = pConInfo->NumberOfHistoryBuffers;
|
||||||
|
ConInfo.HistoryNoDup = !!pConInfo->HistoryNoDup;
|
||||||
|
ConInfo.QuickEdit = !!pConInfo->QuickEdit;
|
||||||
|
ConInfo.InsertMode = !!pConInfo->InsertMode;
|
||||||
|
ConInfo.ScreenBufferSize = pConInfo->ScreenBufferSize;
|
||||||
|
ConInfo.ConsoleSize = pConInfo->WindowSize;
|
||||||
|
ConInfo.CursorSize = pConInfo->CursorSize;
|
||||||
|
ConInfo.ScreenAttrib = pConInfo->ScreenColors;
|
||||||
|
ConInfo.PopupAttrib = pConInfo->PopupColors;
|
||||||
|
memcpy(&ConInfo.Colors, pConInfo->ColorTable, sizeof(ConInfo.Colors));
|
||||||
|
ConInfo.CodePage = pConInfo->CodePage;
|
||||||
|
/**ConInfo.ConsoleTitle[MAX_PATH + 1] = pConInfo->ConsoleTitle; // FIXME: memcpy**/
|
||||||
|
#if 0
|
||||||
|
/* Title of the console, original one corresponding to the one set by the console leader */
|
||||||
|
Length = min(sizeof(pConInfo->ConsoleTitle) / sizeof(pConInfo->ConsoleTitle[0]) - 1,
|
||||||
|
Console->OriginalTitle.Length / sizeof(WCHAR));
|
||||||
|
wcsncpy(pSharedInfo->ci.ConsoleTitle, Console->OriginalTitle.Buffer, Length);
|
||||||
|
#endif
|
||||||
|
// ULONG ConInfo.InputBufferSize = pConInfo->
|
||||||
|
// BOOLEAN ConInfo.CursorBlinkOn = pConInfo->
|
||||||
|
// BOOLEAN ConInfo.ForceCursorOff = pConInfo->
|
||||||
|
|
||||||
|
|
||||||
|
// Terminal information
|
||||||
|
Length = min(wcslen(pConInfo->FaceName) + 1, LF_FACESIZE); // wcsnlen
|
||||||
|
wcsncpy(GuiInfo.FaceName, pConInfo->FaceName, LF_FACESIZE);
|
||||||
|
GuiInfo.FaceName[Length] = L'\0';
|
||||||
|
|
||||||
|
GuiInfo.FontFamily = pConInfo->FontFamily;
|
||||||
|
GuiInfo.FontSize = pConInfo->FontSize;
|
||||||
|
GuiInfo.FontWeight = pConInfo->FontWeight;
|
||||||
|
GuiInfo.FullScreen = !!pConInfo->FullScreen;
|
||||||
|
GuiInfo.AutoPosition = !!pConInfo->AutoPosition;
|
||||||
|
GuiInfo.WindowOrigin = pConInfo->WindowPosition;
|
||||||
|
// BOOL GuiInfo.UseRasterFonts = pConInfo->
|
||||||
|
// WORD GuiInfo.ShowWindow = pConInfo->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we don't set the default parameters,
|
||||||
|
* apply them, otherwise just save them.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
if (pConInfo->ShowDefaultParams == FALSE)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* Set the console informations */
|
||||||
|
ConSrvApplyUserSettings(Console, &ConInfo);
|
||||||
|
|
||||||
|
/* Set the terminal informations */
|
||||||
|
|
||||||
|
// memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
|
||||||
|
|
||||||
|
/* Move the window to the user's values */
|
||||||
|
GuiData->GuiInfo.AutoPosition = GuiInfo.AutoPosition;
|
||||||
|
GuiData->GuiInfo.WindowOrigin = GuiInfo.WindowOrigin;
|
||||||
|
GuiConsoleMoveWindow(GuiData);
|
||||||
|
|
||||||
|
InvalidateRect(GuiData->hWindow, NULL, TRUE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apply full-screen mode.
|
||||||
|
*/
|
||||||
|
if (GuiInfo.FullScreen != GuiData->GuiInfo.FullScreen)
|
||||||
|
{
|
||||||
|
SwitchFullScreen(GuiData, GuiInfo.FullScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
* Save settings if needed
|
||||||
|
*/
|
||||||
|
// FIXME: Do it in the console properties applet ??
|
||||||
|
if (SaveSettings)
|
||||||
|
{
|
||||||
|
DWORD ProcessId = HandleToUlong(ProcessData->Process->ClientId.UniqueProcess);
|
||||||
|
ConSrvWriteUserSettings(&ConInfo, ProcessId);
|
||||||
|
GuiConsoleWriteUserSettings(&GuiInfo, ConInfo.ConsoleTitle, ProcessId);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
DPRINT1("GuiApplyUserSettings - Caught an exception, Status = %08X\n", Status);
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
Quit:
|
||||||
|
/* Finally, close the section and return */
|
||||||
|
if (hSection)
|
||||||
|
{
|
||||||
|
NtUnmapViewOfSection(NtCurrentProcess(), pConInfo);
|
||||||
|
NtClose(hSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
LeaveCriticalSection(&Console->Lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -14,7 +14,16 @@
|
||||||
#ifndef WM_APP
|
#ifndef WM_APP
|
||||||
#define WM_APP 0x8000
|
#define WM_APP 0x8000
|
||||||
#endif
|
#endif
|
||||||
#define PM_APPLY_CONSOLE_INFO (WM_APP + 100)
|
/* Message sent by ReactOS' console.dll for applying console info */
|
||||||
|
#define PM_APPLY_CONSOLE_INFO (WM_APP + 100)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undocumented message sent by Windows' console.dll for applying console info.
|
||||||
|
* See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
|
||||||
|
* and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
#define WM_SETCONSOLEINFO (WM_USER + 201)
|
||||||
|
|
||||||
/* STRUCTURES *****************************************************************/
|
/* STRUCTURES *****************************************************************/
|
||||||
|
|
||||||
|
@ -22,9 +31,9 @@ typedef struct _GUI_CONSOLE_INFO
|
||||||
{
|
{
|
||||||
// FONTSIGNATURE FontSignature;
|
// FONTSIGNATURE FontSignature;
|
||||||
WCHAR FaceName[LF_FACESIZE];
|
WCHAR FaceName[LF_FACESIZE];
|
||||||
UINT FontFamily;
|
ULONG FontFamily;
|
||||||
DWORD FontSize;
|
COORD FontSize;
|
||||||
DWORD FontWeight;
|
ULONG FontWeight;
|
||||||
BOOL UseRasterFonts;
|
BOOL UseRasterFonts;
|
||||||
|
|
||||||
BOOL FullScreen; /* Whether the console is displayed in full-screen or windowed mode */
|
BOOL FullScreen; /* Whether the console is displayed in full-screen or windowed mode */
|
||||||
|
@ -35,6 +44,46 @@ typedef struct _GUI_CONSOLE_INFO
|
||||||
POINT WindowOrigin;
|
POINT WindowOrigin;
|
||||||
} GUI_CONSOLE_INFO, *PGUI_CONSOLE_INFO;
|
} GUI_CONSOLE_INFO, *PGUI_CONSOLE_INFO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undocumented structure used by Windows' console.dll for setting console info.
|
||||||
|
* See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
|
||||||
|
* and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct _CONSOLE_STATE_INFO
|
||||||
|
{
|
||||||
|
ULONG cbSize;
|
||||||
|
COORD ScreenBufferSize;
|
||||||
|
COORD WindowSize;
|
||||||
|
POINT WindowPosition; // WindowPosX and Y
|
||||||
|
|
||||||
|
COORD FontSize;
|
||||||
|
ULONG FontFamily;
|
||||||
|
ULONG FontWeight;
|
||||||
|
WCHAR FaceName[LF_FACESIZE];
|
||||||
|
|
||||||
|
ULONG CursorSize;
|
||||||
|
BOOL FullScreen;
|
||||||
|
BOOL QuickEdit;
|
||||||
|
BOOL AutoPosition;
|
||||||
|
BOOL InsertMode;
|
||||||
|
|
||||||
|
USHORT ScreenColors; // ScreenAttributes
|
||||||
|
USHORT PopupColors; // PopupAttributes
|
||||||
|
BOOL HistoryNoDup;
|
||||||
|
ULONG HistoryBufferSize;
|
||||||
|
ULONG NumberOfHistoryBuffers;
|
||||||
|
|
||||||
|
COLORREF ColorTable[16];
|
||||||
|
|
||||||
|
ULONG CodePage;
|
||||||
|
HWND HWnd;
|
||||||
|
|
||||||
|
WCHAR ConsoleTitle[256];
|
||||||
|
} CONSOLE_STATE_INFO, *PCONSOLE_STATE_INFO;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#ifndef CONSOLE_H__ // If we aren't included by console.dll
|
#ifndef CONSOLE_H__ // If we aren't included by console.dll
|
||||||
|
|
||||||
#include "conwnd.h"
|
#include "conwnd.h"
|
||||||
|
@ -59,6 +108,9 @@ VOID
|
||||||
GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
|
GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData,
|
||||||
HANDLE hClientSection,
|
HANDLE hClientSection,
|
||||||
BOOL SaveSettings);
|
BOOL SaveSettings);
|
||||||
|
VOID
|
||||||
|
GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData,
|
||||||
|
HANDLE hClientSection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
/* STRUCTURES *****************************************************************/
|
/* STRUCTURES *****************************************************************/
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure used to hold terminal-specific information
|
* Structure used to hold terminal-specific information
|
||||||
*/
|
*/
|
||||||
|
@ -69,6 +71,8 @@ typedef struct _CONSOLE_PROPS
|
||||||
TERMINAL_INFO TerminalInfo; /* Frontend-specific parameters */
|
TERMINAL_INFO TerminalInfo; /* Frontend-specific parameters */
|
||||||
} CONSOLE_PROPS, *PCONSOLE_PROPS;
|
} CONSOLE_PROPS, *PCONSOLE_PROPS;
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
#ifndef CONSOLE_H__ // If we aren't included by console.dll
|
#ifndef CONSOLE_H__ // If we aren't included by console.dll
|
||||||
|
|
Loading…
Reference in a new issue