2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/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 SIZE_T Length
= min(wcslen(szValue
) + 1, LF_FACESIZE
); // wcsnlen
87 wcsncpy(TermInfo
->FaceName
, szValue
, LF_FACESIZE
);
88 TermInfo
->FaceName
[Length
] = L
'\0';
91 else if (!wcscmp(szValueName
, L
"FontFamily"))
93 TermInfo
->FontFamily
= Value
;
96 else if (!wcscmp(szValueName
, L
"FontSize"))
98 TermInfo
->FontSize
.X
= LOWORD(Value
); // Width
99 TermInfo
->FontSize
.Y
= HIWORD(Value
); // Height
102 else if (!wcscmp(szValueName
, L
"FontWeight"))
104 TermInfo
->FontWeight
= Value
;
107 else if (!wcscmp(szValueName
, L
"FullScreen"))
109 TermInfo
->FullScreen
= Value
;
112 else if (!wcscmp(szValueName
, L
"WindowPosition"))
114 TermInfo
->AutoPosition
= FALSE
;
115 TermInfo
->WindowOrigin
.x
= LOWORD(Value
);
116 TermInfo
->WindowOrigin
.y
= HIWORD(Value
);
126 GuiConsoleWriteUserSettings(IN OUT PGUI_CONSOLE_INFO TermInfo
,
127 IN LPCWSTR ConsoleTitle
,
130 /******************************************************
131 * Adapted from ConSrvWriteUserSettings in settings.c *
132 ******************************************************/
134 BOOL GlobalSettings
= (ConsoleTitle
[0] == L
'\0');
138 #define SetConsoleSetting(SettingName, SettingType, SettingSize, Setting, DefaultValue) \
140 if (GlobalSettings || (!GlobalSettings && (*(Setting) != (DefaultValue)))) \
142 RegSetValueExW(hKey, (SettingName), 0, (SettingType), (PBYTE)(Setting), (SettingSize)); \
146 RegDeleteValue(hKey, (SettingName)); \
150 if (!ConSrvOpenUserSettings(ProcessId
,
158 SetConsoleSetting(L
"FaceName", REG_SZ
, (wcslen(TermInfo
->FaceName
) + 1) * sizeof(WCHAR
), TermInfo
->FaceName
, L
'\0'); // wcsnlen
159 SetConsoleSetting(L
"FontFamily", REG_DWORD
, sizeof(DWORD
), &TermInfo
->FontFamily
, FF_DONTCARE
);
161 Storage
= MAKELONG(TermInfo
->FontSize
.X
, TermInfo
->FontSize
.Y
); // Width, Height
162 SetConsoleSetting(L
"FontSize", REG_DWORD
, sizeof(DWORD
), &Storage
, 0);
164 SetConsoleSetting(L
"FontWeight", REG_DWORD
, sizeof(DWORD
), &TermInfo
->FontWeight
, FW_DONTCARE
);
166 Storage
= TermInfo
->FullScreen
;
167 SetConsoleSetting(L
"FullScreen", REG_DWORD
, sizeof(DWORD
), &Storage
, FALSE
);
169 if (TermInfo
->AutoPosition
== FALSE
)
171 Storage
= MAKELONG(TermInfo
->WindowOrigin
.x
, TermInfo
->WindowOrigin
.y
);
172 RegSetValueExW(hKey
, L
"WindowPosition", 0, REG_DWORD
, (PBYTE
)&Storage
, sizeof(DWORD
));
176 RegDeleteValue(hKey
, L
"WindowPosition");
184 GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo
,
187 /*******************************************************
188 * Adapted from ConSrvGetDefaultSettings in settings.c *
189 *******************************************************/
191 if (TermInfo
== NULL
) return;
194 * 1. Load the default values
196 // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE);
197 // TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12
198 // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16
200 wcsncpy(TermInfo
->FaceName
, L
"VGA", LF_FACESIZE
); // HACK: !!
201 // TermInfo->FaceName[0] = L'\0';
202 TermInfo
->FontFamily
= FF_DONTCARE
;
203 TermInfo
->FontSize
.X
= 0;
204 TermInfo
->FontSize
.Y
= 0;
205 TermInfo
->FontWeight
= FW_NORMAL
; // HACK: !!
206 // TermInfo->FontWeight = FW_DONTCARE;
208 TermInfo
->FullScreen
= FALSE
;
209 TermInfo
->ShowWindow
= SW_SHOWNORMAL
;
210 TermInfo
->AutoPosition
= TRUE
;
211 TermInfo
->WindowOrigin
.x
= 0;
212 TermInfo
->WindowOrigin
.y
= 0;
215 * 2. Overwrite them with the ones stored in HKCU\Console.
216 * If the HKCU\Console key doesn't exist, create it
217 * and store the default values inside.
219 if (!GuiConsoleReadUserSettings(TermInfo
, L
"", ProcessId
))
221 GuiConsoleWriteUserSettings(TermInfo
, L
"", ProcessId
);
226 GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData
,
230 PCONSRV_CONSOLE Console
= GuiData
->Console
;
231 PCONSOLE_SCREEN_BUFFER ActiveBuffer
= GuiData
->ActiveBuffer
;
232 PCONSOLE_PROCESS_DATA ProcessData
;
233 HANDLE hSection
= NULL
, hClientSection
= NULL
;
234 LARGE_INTEGER SectionSize
;
237 PCONSOLE_PROPS pSharedInfo
= NULL
;
238 PGUI_CONSOLE_INFO GuiInfo
= NULL
;
240 DPRINT("GuiConsoleShowConsoleProperties entered\n");
242 if (!ConDrvValidateConsoleUnsafe(Console
, CONSOLE_RUNNING
, TRUE
)) return;
245 * Create a memory section to share with the applet, and map it.
247 /* Holds data for console.dll + console info + terminal-specific info */
248 SectionSize
.QuadPart
= sizeof(CONSOLE_PROPS
) + sizeof(GUI_CONSOLE_INFO
);
249 Status
= NtCreateSection(&hSection
,
256 if (!NT_SUCCESS(Status
))
258 DPRINT1("Error: Impossible to create a shared section ; Status = %lu\n", Status
);
262 Status
= NtMapViewOfSection(hSection
,
264 (PVOID
*)&pSharedInfo
,
272 if (!NT_SUCCESS(Status
))
274 DPRINT1("Error: Impossible to map the shared section ; Status = %lu\n", Status
);
280 * Setup the shared console properties structure.
284 pSharedInfo
->hConsoleWindow
= GuiData
->hWindow
;
285 pSharedInfo
->ShowDefaultParams
= Defaults
;
288 * We fill-in the fields only if we display
289 * our properties, not the default ones.
293 /* Console information */
294 pSharedInfo
->ci
.HistoryBufferSize
= Console
->HistoryBufferSize
;
295 pSharedInfo
->ci
.NumberOfHistoryBuffers
= Console
->NumberOfHistoryBuffers
;
296 pSharedInfo
->ci
.HistoryNoDup
= Console
->HistoryNoDup
;
297 pSharedInfo
->ci
.QuickEdit
= Console
->QuickEdit
;
298 pSharedInfo
->ci
.InsertMode
= Console
->InsertMode
;
299 /////////////pSharedInfo->ci.InputBufferSize = 0;
300 pSharedInfo
->ci
.ScreenBufferSize
= ActiveBuffer
->ScreenBufferSize
;
301 pSharedInfo
->ci
.ConsoleSize
= ActiveBuffer
->ViewSize
;
302 pSharedInfo
->ci
.CursorBlinkOn
;
303 pSharedInfo
->ci
.ForceCursorOff
;
304 pSharedInfo
->ci
.CursorSize
= ActiveBuffer
->CursorInfo
.dwSize
;
305 if (GetType(ActiveBuffer
) == TEXTMODE_BUFFER
)
307 PTEXTMODE_SCREEN_BUFFER Buffer
= (PTEXTMODE_SCREEN_BUFFER
)ActiveBuffer
;
309 pSharedInfo
->ci
.ScreenAttrib
= Buffer
->ScreenDefaultAttrib
;
310 pSharedInfo
->ci
.PopupAttrib
= Buffer
->PopupDefaultAttrib
;
312 else // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER)
314 // PGRAPHICS_SCREEN_BUFFER Buffer = (PGRAPHICS_SCREEN_BUFFER)ActiveBuffer;
315 DPRINT1("GuiConsoleShowConsoleProperties - Graphics buffer\n");
317 // FIXME: Gather defaults from the registry ?
318 pSharedInfo
->ci
.ScreenAttrib
= DEFAULT_SCREEN_ATTRIB
;
319 pSharedInfo
->ci
.PopupAttrib
= DEFAULT_POPUP_ATTRIB
;
321 pSharedInfo
->ci
.CodePage
;
323 /* GUI Information */
324 pSharedInfo
->TerminalInfo
.Size
= sizeof(GUI_CONSOLE_INFO
);
325 GuiInfo
= pSharedInfo
->TerminalInfo
.TermInfo
= (PGUI_CONSOLE_INFO
)(pSharedInfo
+ 1);
326 Length
= min(wcslen(GuiData
->GuiInfo
.FaceName
) + 1, LF_FACESIZE
); // wcsnlen
327 wcsncpy(GuiInfo
->FaceName
, GuiData
->GuiInfo
.FaceName
, LF_FACESIZE
);
328 GuiInfo
->FaceName
[Length
] = L
'\0';
329 GuiInfo
->FontFamily
= GuiData
->GuiInfo
.FontFamily
;
330 GuiInfo
->FontSize
= GuiData
->GuiInfo
.FontSize
;
331 GuiInfo
->FontWeight
= GuiData
->GuiInfo
.FontWeight
;
332 GuiInfo
->FullScreen
= GuiData
->GuiInfo
.FullScreen
;
333 GuiInfo
->AutoPosition
= GuiData
->GuiInfo
.AutoPosition
;
334 GuiInfo
->WindowOrigin
= GuiData
->GuiInfo
.WindowOrigin
;
336 pSharedInfo
->TerminalInfo
.TermInfo
= (PVOID
)((ULONG_PTR
)GuiInfo
- (ULONG_PTR
)pSharedInfo
);
339 memcpy(pSharedInfo
->ci
.Colors
, Console
->Colors
, sizeof(Console
->Colors
));
341 /* Title of the console, original one corresponding to the one set by the console leader */
342 Length
= min(sizeof(pSharedInfo
->ci
.ConsoleTitle
) / sizeof(pSharedInfo
->ci
.ConsoleTitle
[0]) - 1,
343 Console
->OriginalTitle
.Length
/ sizeof(WCHAR
));
344 wcsncpy(pSharedInfo
->ci
.ConsoleTitle
, Console
->OriginalTitle
.Buffer
, Length
);
349 // FIXME: Load the default parameters from the registry.
352 /* Null-terminate the title */
353 pSharedInfo
->ci
.ConsoleTitle
[Length
] = L
'\0';
357 NtUnmapViewOfSection(NtCurrentProcess(), pSharedInfo
);
359 /* Get the console leader process, our client */
360 ProcessData
= ConSrvGetConsoleLeaderProcess(Console
);
362 /* Duplicate the section handle for the client */
363 Status
= NtDuplicateObject(NtCurrentProcess(),
365 ProcessData
->Process
->ProcessHandle
,
367 0, 0, DUPLICATE_SAME_ACCESS
);
368 if (!NT_SUCCESS(Status
))
370 DPRINT1("Error: Impossible to duplicate section handle for client ; Status = %lu\n", Status
);
374 /* Start the properties dialog */
375 if (ProcessData
->PropRoutine
)
379 HANDLE Thread
= NULL
;
383 Thread
= CreateRemoteThread(ProcessData
->Process
->ProcessHandle
, NULL
, 0,
384 ProcessData
->PropRoutine
,
385 (PVOID
)hClientSection
, 0, NULL
);
388 DPRINT1("Failed thread creation (Error: 0x%x)\n", GetLastError());
392 DPRINT("ProcessData->PropRoutine remote thread creation succeeded, ProcessId = %x, Process = 0x%p\n",
393 ProcessData
->Process
->ClientId
.UniqueProcess
, ProcessData
->Process
);
394 /// WaitForSingleObject(Thread, INFINITE);
403 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
405 Status
= _SEH2_GetExceptionCode();
406 DPRINT1("GuiConsoleShowConsoleProperties - Caught an exception, Status = %08X\n", Status
);
412 /* We have finished, close the section handle */
413 if (hSection
) NtClose(hSection
);
415 LeaveCriticalSection(&Console
->Lock
);
420 GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData
,
421 HANDLE hClientSection
,
424 NTSTATUS Status
= STATUS_SUCCESS
;
425 PCONSRV_CONSOLE Console
= GuiData
->Console
;
426 PCONSOLE_PROCESS_DATA ProcessData
;
427 HANDLE hSection
= NULL
;
429 PCONSOLE_PROPS pConInfo
= NULL
;
430 PCONSOLE_INFO ConInfo
= NULL
;
431 PTERMINAL_INFO TermInfo
= NULL
;
432 PGUI_CONSOLE_INFO GuiInfo
= NULL
;
434 if (!ConDrvValidateConsoleUnsafe(Console
, CONSOLE_RUNNING
, TRUE
)) return;
436 /* Get the console leader process, our client */
437 ProcessData
= ConSrvGetConsoleLeaderProcess(Console
);
439 /* Duplicate the section handle for ourselves */
440 Status
= NtDuplicateObject(ProcessData
->Process
->ProcessHandle
,
444 0, 0, DUPLICATE_SAME_ACCESS
);
445 if (!NT_SUCCESS(Status
))
447 DPRINT1("Error when mapping client handle, Status = %lu\n", Status
);
451 /* Get a view of the shared section */
452 Status
= NtMapViewOfSection(hSection
,
462 if (!NT_SUCCESS(Status
))
464 DPRINT1("Error when mapping view of file, Status = %lu\n", Status
);
470 /* Check that the section is well-sized */
471 if ( (ViewSize
< sizeof(CONSOLE_PROPS
)) ||
472 (pConInfo
->TerminalInfo
.Size
!= sizeof(GUI_CONSOLE_INFO
)) ||
473 (ViewSize
< sizeof(CONSOLE_PROPS
) + pConInfo
->TerminalInfo
.Size
) )
475 DPRINT1("Error: section bad-sized: sizeof(Section) < sizeof(CONSOLE_PROPS) + sizeof(Terminal_specific_info)\n");
476 Status
= STATUS_INVALID_VIEW_SIZE
;
477 _SEH2_YIELD(goto Quit
);
480 // TODO: Check that GuiData->hWindow == pConInfo->hConsoleWindow
482 /* Retrieve terminal informations */
483 ConInfo
= &pConInfo
->ci
;
484 TermInfo
= &pConInfo
->TerminalInfo
;
485 GuiInfo
= TermInfo
->TermInfo
= (PVOID
)((ULONG_PTR
)pConInfo
+ (ULONG_PTR
)TermInfo
->TermInfo
);
488 * If we don't set the default parameters,
489 * apply them, otherwise just save them.
491 if (pConInfo
->ShowDefaultParams
== FALSE
)
493 /* Set the console informations */
494 ConSrvApplyUserSettings(Console
, ConInfo
);
496 /* Set the terminal informations */
498 // memcpy(&GuiData->GuiInfo, GuiInfo, sizeof(GUI_CONSOLE_INFO));
500 /* Change the font */
505 GuiInfo
->FontWeight
);
506 // HACK, needed because changing font may change the size of the window
507 /**/TermResizeTerminal(Console
);/**/
509 /* Move the window to the user's values */
510 GuiData
->GuiInfo
.AutoPosition
= GuiInfo
->AutoPosition
;
511 GuiData
->GuiInfo
.WindowOrigin
= GuiInfo
->WindowOrigin
;
512 GuiConsoleMoveWindow(GuiData
);
514 InvalidateRect(GuiData
->hWindow
, NULL
, TRUE
);
517 * Apply full-screen mode.
519 if (GuiInfo
->FullScreen
!= GuiData
->GuiInfo
.FullScreen
)
521 SwitchFullScreen(GuiData
, GuiInfo
->FullScreen
);
526 * Save settings if needed
528 // FIXME: Do it in the console properties applet ??
531 DWORD ProcessId
= HandleToUlong(ProcessData
->Process
->ClientId
.UniqueProcess
);
532 ConSrvWriteUserSettings(ConInfo
, ProcessId
);
533 GuiConsoleWriteUserSettings(GuiInfo
, ConInfo
->ConsoleTitle
, ProcessId
);
536 Status
= STATUS_SUCCESS
;
538 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
540 Status
= _SEH2_GetExceptionCode();
541 DPRINT1("GuiApplyUserSettings - Caught an exception, Status = %08X\n", Status
);
546 /* Finally, close the section and return */
549 NtUnmapViewOfSection(NtCurrentProcess(), pConInfo
);
553 LeaveCriticalSection(&Console
->Lock
);
558 * Function for dealing with the undocumented message and structure used by
559 * Windows' console.dll for setting console info.
560 * See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
561 * and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
562 * for more information.
565 GuiApplyWindowsConsoleSettings(PGUI_CONSOLE_DATA GuiData
,
566 HANDLE hClientSection
)
568 NTSTATUS Status
= STATUS_SUCCESS
;
569 PCONSRV_CONSOLE Console
= GuiData
->Console
;
570 PCONSOLE_PROCESS_DATA ProcessData
;
571 HANDLE hSection
= NULL
;
573 PCONSOLE_STATE_INFO pConInfo
= NULL
;
574 CONSOLE_INFO ConInfo
;
575 GUI_CONSOLE_INFO GuiInfo
;
578 if (!ConDrvValidateConsoleUnsafe(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 = %lu\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 = %lu\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 Length
= min(wcslen(pConInfo
->FaceName
) + 1, LF_FACESIZE
); // wcsnlen
653 wcsncpy(GuiInfo
.FaceName
, pConInfo
->FaceName
, LF_FACESIZE
);
654 GuiInfo
.FaceName
[Length
] = L
'\0';
656 GuiInfo
.FontFamily
= pConInfo
->FontFamily
;
657 GuiInfo
.FontSize
= pConInfo
->FontSize
;
658 GuiInfo
.FontWeight
= pConInfo
->FontWeight
;
659 GuiInfo
.FullScreen
= !!pConInfo
->FullScreen
;
660 GuiInfo
.AutoPosition
= !!pConInfo
->AutoPosition
;
661 GuiInfo
.WindowOrigin
= pConInfo
->WindowPosition
;
662 // WORD GuiInfo.ShowWindow = pConInfo->
667 * If we don't set the default parameters,
668 * apply them, otherwise just save them.
671 if (pConInfo
->ShowDefaultParams
== FALSE
)
674 /* Set the console informations */
675 ConSrvApplyUserSettings(Console
, &ConInfo
);
677 /* Set the terminal informations */
679 // memcpy(&GuiData->GuiInfo, &GuiInfo, sizeof(GUI_CONSOLE_INFO));
681 /* Change the font */
687 // HACK, needed because changing font may change the size of the window
688 /**/TermResizeTerminal(Console
);/**/
690 /* Move the window to the user's values */
691 GuiData
->GuiInfo
.AutoPosition
= GuiInfo
.AutoPosition
;
692 GuiData
->GuiInfo
.WindowOrigin
= GuiInfo
.WindowOrigin
;
693 GuiConsoleMoveWindow(GuiData
);
695 InvalidateRect(GuiData
->hWindow
, NULL
, TRUE
);
698 * Apply full-screen mode.
700 if (GuiInfo
.FullScreen
!= GuiData
->GuiInfo
.FullScreen
)
702 SwitchFullScreen(GuiData
, GuiInfo
.FullScreen
);
708 * Save settings if needed
710 // FIXME: Do it in the console properties applet ??
713 DWORD ProcessId
= HandleToUlong(ProcessData
->Process
->ClientId
.UniqueProcess
);
714 ConSrvWriteUserSettings(&ConInfo
, ProcessId
);
715 GuiConsoleWriteUserSettings(&GuiInfo
, ConInfo
.ConsoleTitle
, ProcessId
);
719 Status
= STATUS_SUCCESS
;
721 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
723 Status
= _SEH2_GetExceptionCode();
724 DPRINT1("GuiApplyUserSettings - Caught an exception, Status = %08X\n", Status
);
729 /* Finally, close the section and return */
732 NtUnmapViewOfSection(NtCurrentProcess(), pConInfo
);
736 LeaveCriticalSection(&Console
->Lock
);