2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: consrv/frontends/gui/guisettings.c
5 * PURPOSE: GUI Terminal Front-End Settings Management
6 * PROGRAMMERS: Johannes Anderwald
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10 /* INCLUDES *******************************************************************/
18 #include "guisettings.h"
20 /* FUNCTIONS ******************************************************************/
23 GuiConsoleReadUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo
,
24 IN LPCWSTR ConsoleTitle
,
27 /*****************************************************
28 * Adapted from ConSrvReadUserSettings in settings.c *
29 *****************************************************/
33 DWORD dwNumSubKeys
= 0;
36 WCHAR szValueName
[MAX_PATH
];
38 WCHAR szValue
[LF_FACESIZE
] = L
"\0";
42 if (!ConSrvOpenUserSettings(ProcessId
,
47 DPRINT("ConSrvOpenUserSettings failed\n");
51 if (RegQueryInfoKey(hKey
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
,
52 &dwNumSubKeys
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
54 DPRINT("GuiConsoleReadUserSettings: RegQueryInfoKey failed\n");
59 DPRINT("GuiConsoleReadUserSettings entered dwNumSubKeys %d\n", dwNumSubKeys
);
61 for (dwIndex
= 0; dwIndex
< dwNumSubKeys
; dwIndex
++)
63 dwValue
= sizeof(Value
);
64 dwValueName
= MAX_PATH
; // sizeof(szValueName)/sizeof(szValueName[0])
66 if (RegEnumValueW(hKey
, dwIndex
, szValueName
, &dwValueName
, NULL
, &dwType
, (BYTE
*)&Value
, &dwValue
) != ERROR_SUCCESS
)
71 * Retry in case of string value
73 dwValue
= sizeof(szValue
);
74 dwValueName
= MAX_PATH
; // sizeof(szValueName)/sizeof(szValueName[0])
75 if (RegEnumValueW(hKey
, dwIndex
, szValueName
, &dwValueName
, NULL
, NULL
, (BYTE
*)szValue
, &dwValue
) != ERROR_SUCCESS
)
84 if (!wcscmp(szValueName
, L
"FaceName"))
86 wcsncpy(TermInfo
->FaceName
, szValue
, LF_FACESIZE
);
87 TermInfo
->FaceName
[LF_FACESIZE
- 1] = UNICODE_NULL
;
90 else if (!wcscmp(szValueName
, L
"FontFamily"))
92 TermInfo
->FontFamily
= Value
;
95 else if (!wcscmp(szValueName
, L
"FontSize"))
97 TermInfo
->FontSize
.X
= LOWORD(Value
); // Width
98 TermInfo
->FontSize
.Y
= HIWORD(Value
); // Height
101 else if (!wcscmp(szValueName
, L
"FontWeight"))
103 TermInfo
->FontWeight
= Value
;
106 else if (!wcscmp(szValueName
, L
"FullScreen"))
108 TermInfo
->FullScreen
= Value
;
111 else if (!wcscmp(szValueName
, L
"WindowPosition"))
113 TermInfo
->AutoPosition
= FALSE
;
114 TermInfo
->WindowOrigin
.x
= LOWORD(Value
);
115 TermInfo
->WindowOrigin
.y
= HIWORD(Value
);
125 GuiConsoleWriteUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo
,
126 IN LPCWSTR ConsoleTitle
,
129 /******************************************************
130 * Adapted from ConSrvWriteUserSettings in settings.c *
131 ******************************************************/
133 BOOL GlobalSettings
= (ConsoleTitle
[0] == L
'\0');
137 #define SetConsoleSetting(SettingName, SettingType, SettingSize, Setting, DefaultValue) \
139 if (GlobalSettings || (!GlobalSettings && (*(Setting) != (DefaultValue)))) \
141 RegSetValueExW(hKey, (SettingName), 0, (SettingType), (PBYTE)(Setting), (SettingSize)); \
145 RegDeleteValue(hKey, (SettingName)); \
149 if (!ConSrvOpenUserSettings(ProcessId
,
157 SetConsoleSetting(L
"FaceName", REG_SZ
, (wcslen(TermInfo
->FaceName
) + 1) * sizeof(WCHAR
), TermInfo
->FaceName
, L
'\0'); // wcsnlen
158 SetConsoleSetting(L
"FontFamily", REG_DWORD
, sizeof(DWORD
), &TermInfo
->FontFamily
, FF_DONTCARE
);
160 Storage
= MAKELONG(TermInfo
->FontSize
.X
, TermInfo
->FontSize
.Y
); // Width, Height
161 SetConsoleSetting(L
"FontSize", REG_DWORD
, sizeof(DWORD
), &Storage
, 0);
163 SetConsoleSetting(L
"FontWeight", REG_DWORD
, sizeof(DWORD
), &TermInfo
->FontWeight
, FW_DONTCARE
);
165 Storage
= TermInfo
->FullScreen
;
166 SetConsoleSetting(L
"FullScreen", REG_DWORD
, sizeof(DWORD
), &Storage
, FALSE
);
168 if (TermInfo
->AutoPosition
== FALSE
)
170 Storage
= MAKELONG(TermInfo
->WindowOrigin
.x
, TermInfo
->WindowOrigin
.y
);
171 RegSetValueExW(hKey
, L
"WindowPosition", 0, REG_DWORD
, (PBYTE
)&Storage
, sizeof(DWORD
));
175 RegDeleteValue(hKey
, L
"WindowPosition");
183 GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo
,
186 /*******************************************************
187 * Adapted from ConSrvGetDefaultSettings in settings.c *
188 *******************************************************/
190 if (TermInfo
== NULL
) return;
193 * 1. Load the default values
195 // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE);
196 // TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12
197 // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16
199 wcsncpy(TermInfo
->FaceName
, L
"VGA", LF_FACESIZE
); // HACK: !!
200 // TermInfo->FaceName[0] = L'\0';
201 TermInfo
->FontFamily
= FF_DONTCARE
;
202 TermInfo
->FontSize
.X
= 0;
203 TermInfo
->FontSize
.Y
= 0;
204 TermInfo
->FontWeight
= FW_NORMAL
; // HACK: !!
205 // TermInfo->FontWeight = FW_DONTCARE;
207 TermInfo
->FullScreen
= FALSE
;
208 TermInfo
->ShowWindow
= SW_SHOWNORMAL
;
209 TermInfo
->AutoPosition
= TRUE
;
210 TermInfo
->WindowOrigin
.x
= 0;
211 TermInfo
->WindowOrigin
.y
= 0;
214 * 2. Overwrite them with the ones stored in HKCU\Console.
215 * If the HKCU\Console key doesn't exist, create it
216 * and store the default values inside.
218 if (!GuiConsoleReadUserSettings(TermInfo
, L
"", ProcessId
))
220 GuiConsoleWriteUserSettings(TermInfo
, L
"", ProcessId
);
225 GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData
,
229 PCONSRV_CONSOLE Console
= GuiData
->Console
;
230 PCONSOLE_SCREEN_BUFFER ActiveBuffer
= GuiData
->ActiveBuffer
;
231 PCONSOLE_PROCESS_DATA ProcessData
;
232 HANDLE hSection
= NULL
, hClientSection
= NULL
;
233 LARGE_INTEGER SectionSize
;
236 PCONSOLE_PROPS pSharedInfo
= NULL
;
237 PGUI_CONSOLE_INFO GuiInfo
= NULL
;
239 DPRINT("GuiConsoleShowConsoleProperties entered\n");
241 if (!ConDrvValidateConsoleUnsafe((PCONSOLE
)Console
, CONSOLE_RUNNING
, TRUE
)) return;
244 * Create a memory section to share with the applet, and map it.
246 /* Holds data for console.dll + console info + terminal-specific info */
247 SectionSize
.QuadPart
= sizeof(CONSOLE_PROPS
) + sizeof(GUI_CONSOLE_INFO
);
248 Status
= NtCreateSection(&hSection
,
255 if (!NT_SUCCESS(Status
))
257 DPRINT1("Error: Impossible to create a shared section, Status = 0x%08lx\n", Status
);
261 Status
= NtMapViewOfSection(hSection
,
263 (PVOID
*)&pSharedInfo
,
271 if (!NT_SUCCESS(Status
))
273 DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status
);
279 * Setup the shared console properties structure.
283 pSharedInfo
->hConsoleWindow
= GuiData
->hWindow
;
284 pSharedInfo
->ShowDefaultParams
= Defaults
;
287 * We fill-in the fields only if we display
288 * our properties, not the default ones.
292 /* Console information */
293 pSharedInfo
->ci
.HistoryBufferSize
= Console
->HistoryBufferSize
;
294 pSharedInfo
->ci
.NumberOfHistoryBuffers
= Console
->NumberOfHistoryBuffers
;
295 pSharedInfo
->ci
.HistoryNoDup
= Console
->HistoryNoDup
;
296 pSharedInfo
->ci
.QuickEdit
= Console
->QuickEdit
;
297 pSharedInfo
->ci
.InsertMode
= Console
->InsertMode
;
298 /////////////pSharedInfo->ci.InputBufferSize = 0;
299 pSharedInfo
->ci
.ScreenBufferSize
= ActiveBuffer
->ScreenBufferSize
;
300 pSharedInfo
->ci
.ConsoleSize
= ActiveBuffer
->ViewSize
;
301 pSharedInfo
->ci
.CursorBlinkOn
;
302 pSharedInfo
->ci
.ForceCursorOff
;
303 pSharedInfo
->ci
.CursorSize
= ActiveBuffer
->CursorInfo
.dwSize
;
304 if (GetType(ActiveBuffer
) == TEXTMODE_BUFFER
)
306 PTEXTMODE_SCREEN_BUFFER Buffer
= (PTEXTMODE_SCREEN_BUFFER
)ActiveBuffer
;
308 pSharedInfo
->ci
.ScreenAttrib
= Buffer
->ScreenDefaultAttrib
;
309 pSharedInfo
->ci
.PopupAttrib
= Buffer
->PopupDefaultAttrib
;
311 else // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER)
313 // PGRAPHICS_SCREEN_BUFFER Buffer = (PGRAPHICS_SCREEN_BUFFER)ActiveBuffer;
314 DPRINT1("GuiConsoleShowConsoleProperties - Graphics buffer\n");
316 // FIXME: Gather defaults from the registry ?
317 pSharedInfo
->ci
.ScreenAttrib
= DEFAULT_SCREEN_ATTRIB
;
318 pSharedInfo
->ci
.PopupAttrib
= DEFAULT_POPUP_ATTRIB
;
320 pSharedInfo
->ci
.CodePage
;
322 /* GUI Information */
323 pSharedInfo
->TerminalInfo
.Size
= sizeof(GUI_CONSOLE_INFO
);
324 GuiInfo
= pSharedInfo
->TerminalInfo
.TermInfo
= (PGUI_CONSOLE_INFO
)(pSharedInfo
+ 1);
325 wcsncpy(GuiInfo
->FaceName
, GuiData
->GuiInfo
.FaceName
, LF_FACESIZE
);
326 GuiInfo
->FaceName
[LF_FACESIZE
- 1] = UNICODE_NULL
;
327 GuiInfo
->FontFamily
= GuiData
->GuiInfo
.FontFamily
;
328 GuiInfo
->FontSize
= GuiData
->GuiInfo
.FontSize
;
329 GuiInfo
->FontWeight
= GuiData
->GuiInfo
.FontWeight
;
330 GuiInfo
->FullScreen
= GuiData
->GuiInfo
.FullScreen
;
331 GuiInfo
->AutoPosition
= GuiData
->GuiInfo
.AutoPosition
;
332 GuiInfo
->WindowOrigin
= GuiData
->GuiInfo
.WindowOrigin
;
334 pSharedInfo
->TerminalInfo
.TermInfo
= (PVOID
)((ULONG_PTR
)GuiInfo
- (ULONG_PTR
)pSharedInfo
);
337 memcpy(pSharedInfo
->ci
.Colors
, Console
->Colors
, sizeof(Console
->Colors
));
339 /* Title of the console, original one corresponding to the one set by the console leader */
340 Length
= min(sizeof(pSharedInfo
->ci
.ConsoleTitle
) / sizeof(pSharedInfo
->ci
.ConsoleTitle
[0]) - 1,
341 Console
->OriginalTitle
.Length
/ sizeof(WCHAR
));
342 wcsncpy(pSharedInfo
->ci
.ConsoleTitle
, Console
->OriginalTitle
.Buffer
, Length
);
347 // FIXME: Load the default parameters from the registry.
350 /* Null-terminate the title */
351 pSharedInfo
->ci
.ConsoleTitle
[Length
] = L
'\0';
355 NtUnmapViewOfSection(NtCurrentProcess(), pSharedInfo
);
357 /* Get the console leader process, our client */
358 ProcessData
= ConSrvGetConsoleLeaderProcess(Console
);
360 /* Duplicate the section handle for the client */
361 Status
= NtDuplicateObject(NtCurrentProcess(),
363 ProcessData
->Process
->ProcessHandle
,
365 0, 0, DUPLICATE_SAME_ACCESS
);
366 if (!NT_SUCCESS(Status
))
368 DPRINT1("Error: Impossible to duplicate section handle for client, Status = 0x%08lx\n", Status
);
372 /* Start the properties dialog */
373 if (ProcessData
->PropRoutine
)
377 HANDLE Thread
= NULL
;
381 Thread
= CreateRemoteThread(ProcessData
->Process
->ProcessHandle
, NULL
, 0,
382 ProcessData
->PropRoutine
,
383 (PVOID
)hClientSection
, 0, NULL
);
386 DPRINT1("Failed thread creation (Error: 0x%x)\n", GetLastError());
390 DPRINT("ProcessData->PropRoutine remote thread creation succeeded, ProcessId = %x, Process = 0x%p\n",
391 ProcessData
->Process
->ClientId
.UniqueProcess
, ProcessData
->Process
);
392 /// WaitForSingleObject(Thread, INFINITE);
401 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
403 Status
= _SEH2_GetExceptionCode();
404 DPRINT1("GuiConsoleShowConsoleProperties - Caught an exception, Status = 0x%08lx\n", Status
);
410 /* We have finished, close the section handle */
411 if (hSection
) NtClose(hSection
);
413 LeaveCriticalSection(&Console
->Lock
);
418 GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData
,
419 HANDLE hClientSection
,
422 NTSTATUS Status
= STATUS_SUCCESS
;
423 PCONSRV_CONSOLE Console
= GuiData
->Console
;
424 PCONSOLE_PROCESS_DATA ProcessData
;
425 HANDLE hSection
= NULL
;
427 PCONSOLE_PROPS pConInfo
= NULL
;
428 PCONSOLE_INFO ConInfo
= NULL
;
429 PTERMINAL_INFO TermInfo
= NULL
;
430 PGUI_CONSOLE_INFO GuiInfo
= NULL
;
432 if (!ConDrvValidateConsoleUnsafe((PCONSOLE
)Console
, CONSOLE_RUNNING
, TRUE
)) return;
434 /* Get the console leader process, our client */
435 ProcessData
= ConSrvGetConsoleLeaderProcess(Console
);
437 /* Duplicate the section handle for ourselves */
438 Status
= NtDuplicateObject(ProcessData
->Process
->ProcessHandle
,
442 0, 0, DUPLICATE_SAME_ACCESS
);
443 if (!NT_SUCCESS(Status
))
445 DPRINT1("Error when mapping client handle, Status = 0x%08lx\n", Status
);
449 /* Get a view of the shared section */
450 Status
= NtMapViewOfSection(hSection
,
460 if (!NT_SUCCESS(Status
))
462 DPRINT1("Error when mapping view of file, Status = 0x%08lx\n", Status
);
468 /* Check that the section is well-sized */
469 if ( (ViewSize
< sizeof(CONSOLE_PROPS
)) ||
470 (pConInfo
->TerminalInfo
.Size
!= sizeof(GUI_CONSOLE_INFO
)) ||
471 (ViewSize
< sizeof(CONSOLE_PROPS
) + pConInfo
->TerminalInfo
.Size
) )
473 DPRINT1("Error: section bad-sized: sizeof(Section) < sizeof(CONSOLE_PROPS) + sizeof(Terminal_specific_info)\n");
474 Status
= STATUS_INVALID_VIEW_SIZE
;
475 _SEH2_YIELD(goto Quit
);
478 // TODO: Check that GuiData->hWindow == pConInfo->hConsoleWindow
480 /* Retrieve terminal informations */
481 ConInfo
= &pConInfo
->ci
;
482 TermInfo
= &pConInfo
->TerminalInfo
;
483 GuiInfo
= TermInfo
->TermInfo
= (PVOID
)((ULONG_PTR
)pConInfo
+ (ULONG_PTR
)TermInfo
->TermInfo
);
486 * If we don't set the default parameters,
487 * apply them, otherwise just save them.
489 if (pConInfo
->ShowDefaultParams
== FALSE
)
491 /* Set the console informations */
492 ConSrvApplyUserSettings(Console
, ConInfo
);
494 /* Set the terminal informations */
496 // memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO));
498 /* Change the font */
503 GuiInfo
->FontWeight
);
504 // HACK, needed because changing font may change the size of the window
505 /**/TermResizeTerminal(Console
);/**/
507 /* Move the window to the user's values */
508 GuiData
->GuiInfo
.AutoPosition
= GuiInfo
->AutoPosition
;
509 GuiData
->GuiInfo
.WindowOrigin
= GuiInfo
->WindowOrigin
;
510 GuiConsoleMoveWindow(GuiData
);
512 InvalidateRect(GuiData
->hWindow
, NULL
, TRUE
);
515 * Apply full-screen mode.
517 if (GuiInfo
->FullScreen
!= GuiData
->GuiInfo
.FullScreen
)
519 SwitchFullScreen(GuiData
, GuiInfo
->FullScreen
);
524 * Save settings if needed
526 // FIXME: Do it in the console properties applet ??
529 DWORD ProcessId
= HandleToUlong(ProcessData
->Process
->ClientId
.UniqueProcess
);
530 ConSrvWriteUserSettings(ConInfo
, ProcessId
);
531 GuiConsoleWriteUserSettings(GuiInfo
, ConInfo
->ConsoleTitle
, ProcessId
);
534 Status
= STATUS_SUCCESS
;
536 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
538 Status
= _SEH2_GetExceptionCode();
539 DPRINT1("GuiApplyUserSettings - Caught an exception, Status = 0x%08lx\n", Status
);
544 /* Finally, close the section and return */
547 NtUnmapViewOfSection(NtCurrentProcess(), pConInfo
);
551 LeaveCriticalSection(&Console
->Lock
);
556 * Function for dealing with the undocumented message and structure used by
557 * Windows' console.dll for setting console info.
558 * See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
559 * and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
560 * for more information.
563 GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData
,
564 HANDLE hClientSection
)
566 NTSTATUS Status
= STATUS_SUCCESS
;
567 PCONSRV_CONSOLE Console
= GuiData
->Console
;
568 PCONSOLE_PROCESS_DATA ProcessData
;
569 HANDLE hSection
= NULL
;
571 PCONSOLE_STATE_INFO pConInfo
= NULL
;
572 CONSOLE_INFO ConInfo
;
573 GUI_CONSOLE_INFO GuiInfo
;
578 if (!ConDrvValidateConsoleUnsafe((PCONSOLE
)Console
, CONSOLE_RUNNING
, TRUE
)) return;
580 /* Get the console leader process, our client */
581 ProcessData
= ConSrvGetConsoleLeaderProcess(Console
);
583 /* Duplicate the section handle for ourselves */
584 Status
= NtDuplicateObject(ProcessData
->Process
->ProcessHandle
,
588 0, 0, DUPLICATE_SAME_ACCESS
);
589 if (!NT_SUCCESS(Status
))
591 DPRINT1("Error when mapping client handle, Status = 0x%08lx\n", Status
);
595 /* Get a view of the shared section */
596 Status
= NtMapViewOfSection(hSection
,
606 if (!NT_SUCCESS(Status
))
608 DPRINT1("Error when mapping view of file, Status = 0x%08lx\n", Status
);
614 /* Check that the section is well-sized */
615 if ( (ViewSize
< sizeof(CONSOLE_STATE_INFO
)) ||
616 (pConInfo
->cbSize
!= sizeof(CONSOLE_STATE_INFO
)) )
618 DPRINT1("Error: section bad-sized: sizeof(Section) < sizeof(CONSOLE_STATE_INFO)\n");
619 Status
= STATUS_INVALID_VIEW_SIZE
;
620 _SEH2_YIELD(goto Quit
);
623 // TODO: Check that GuiData->hWindow == pConInfo->hConsoleWindow
625 /* Retrieve terminal informations */
627 // Console information
628 ConInfo
.HistoryBufferSize
= pConInfo
->HistoryBufferSize
;
629 ConInfo
.NumberOfHistoryBuffers
= pConInfo
->NumberOfHistoryBuffers
;
630 ConInfo
.HistoryNoDup
= !!pConInfo
->HistoryNoDup
;
631 ConInfo
.QuickEdit
= !!pConInfo
->QuickEdit
;
632 ConInfo
.InsertMode
= !!pConInfo
->InsertMode
;
633 ConInfo
.ScreenBufferSize
= pConInfo
->ScreenBufferSize
;
634 ConInfo
.ConsoleSize
= pConInfo
->WindowSize
;
635 ConInfo
.CursorSize
= pConInfo
->CursorSize
;
636 ConInfo
.ScreenAttrib
= pConInfo
->ScreenColors
;
637 ConInfo
.PopupAttrib
= pConInfo
->PopupColors
;
638 memcpy(&ConInfo
.Colors
, pConInfo
->ColorTable
, sizeof(ConInfo
.Colors
));
639 ConInfo
.CodePage
= pConInfo
->CodePage
;
640 /**ConInfo.ConsoleTitle[MAX_PATH + 1] = pConInfo->ConsoleTitle; // FIXME: memcpy**/
642 /* Title of the console, original one corresponding to the one set by the console leader */
643 Length
= min(sizeof(pConInfo
->ConsoleTitle
) / sizeof(pConInfo
->ConsoleTitle
[0]) - 1,
644 Console
->OriginalTitle
.Length
/ sizeof(WCHAR
));
645 wcsncpy(pSharedInfo
->ci
.ConsoleTitle
, Console
->OriginalTitle
.Buffer
, Length
);
647 // BOOLEAN ConInfo.CursorBlinkOn = pConInfo->
648 // BOOLEAN ConInfo.ForceCursorOff = pConInfo->
651 // Terminal information
652 wcsncpy(GuiInfo
.FaceName
, pConInfo
->FaceName
, LF_FACESIZE
);
653 GuiInfo
.FaceName
[LF_FACESIZE
- 1] = UNICODE_NULL
;
655 GuiInfo
.FontFamily
= pConInfo
->FontFamily
;
656 GuiInfo
.FontSize
= pConInfo
->FontSize
;
657 GuiInfo
.FontWeight
= pConInfo
->FontWeight
;
658 GuiInfo
.FullScreen
= !!pConInfo
->FullScreen
;
659 GuiInfo
.AutoPosition
= !!pConInfo
->AutoPosition
;
660 GuiInfo
.WindowOrigin
= pConInfo
->WindowPosition
;
661 // WORD GuiInfo.ShowWindow = pConInfo->
666 * If we don't set the default parameters,
667 * apply them, otherwise just save them.
670 if (pConInfo
->ShowDefaultParams
== FALSE
)
673 /* Set the console informations */
674 ConSrvApplyUserSettings(Console
, &ConInfo
);
676 /* Set the terminal informations */
678 // memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
680 /* Change the font */
686 // HACK, needed because changing font may change the size of the window
687 /**/TermResizeTerminal(Console
);/**/
689 /* Move the window to the user's values */
690 GuiData
->GuiInfo
.AutoPosition
= GuiInfo
.AutoPosition
;
691 GuiData
->GuiInfo
.WindowOrigin
= GuiInfo
.WindowOrigin
;
692 GuiConsoleMoveWindow(GuiData
);
694 InvalidateRect(GuiData
->hWindow
, NULL
, TRUE
);
697 * Apply full-screen mode.
699 if (GuiInfo
.FullScreen
!= GuiData
->GuiInfo
.FullScreen
)
701 SwitchFullScreen(GuiData
, GuiInfo
.FullScreen
);
707 * Save settings if needed
709 // FIXME: Do it in the console properties applet ??
712 DWORD ProcessId
= HandleToUlong(ProcessData
->Process
->ClientId
.UniqueProcess
);
713 ConSrvWriteUserSettings(&ConInfo
, ProcessId
);
714 GuiConsoleWriteUserSettings(&GuiInfo
, ConInfo
.ConsoleTitle
, ProcessId
);
718 Status
= STATUS_SUCCESS
;
720 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
722 Status
= _SEH2_GetExceptionCode();
723 DPRINT1("GuiApplyUserSettings - Caught an exception, Status = 0x%08lx\n", Status
);
728 /* Finally, close the section and return */
731 NtUnmapViewOfSection(NtCurrentProcess(), pConInfo
);
735 LeaveCriticalSection(&Console
->Lock
);