VOID GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, IN DWORD ProcessId) { /******************************************************* * Adapted from ConSrvGetDefaultSettings in settings.c * *******************************************************/ if (TermInfo == NULL) return; /* * 1. Load the default values */ // wcsncpy(TermInfo->FaceName, L"DejaVu Sans Mono", LF_FACESIZE); // TermInfo->FontSize = MAKELONG(8, 12); // 0x000C0008; // font is 8x12 // TermInfo->FontSize = MAKELONG(16, 16); // font is 16x16 wcsncpy(TermInfo->FaceName, L"VGA", LF_FACESIZE); // HACK: !! // TermInfo->FaceName[0] = L'\0'; TermInfo->FontFamily = FF_DONTCARE; TermInfo->FontSize.X = 0; TermInfo->FontSize.Y = 0; TermInfo->FontWeight = FW_NORMAL; // HACK: !! // TermInfo->FontWeight = FW_DONTCARE; TermInfo->FullScreen = FALSE; TermInfo->ShowWindow = SW_SHOWNORMAL; TermInfo->AutoPosition = TRUE; TermInfo->WindowOrigin.x = 0; TermInfo->WindowOrigin.y = 0; /* * 2. Overwrite them with the ones stored in HKCU\Console. * If the HKCU\Console key doesn't exist, create it * and store the default values inside. */ if (!GuiConsoleReadUserSettings(TermInfo, L"", ProcessId)) { GuiConsoleWriteUserSettings(TermInfo, L"", ProcessId); } }
NTSTATUS NTAPI GuiLoadFrontEnd(IN OUT PFRONTEND FrontEnd, IN OUT PCONSOLE_STATE_INFO ConsoleInfo, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo, IN HANDLE ConsoleLeaderProcessHandle) { PCONSOLE_START_INFO ConsoleStartInfo; PGUI_INIT_INFO GuiInitInfo; if (FrontEnd == NULL || ConsoleInfo == NULL || ConsoleInitInfo == NULL) return STATUS_INVALID_PARAMETER; ConsoleStartInfo = ConsoleInitInfo->ConsoleStartInfo; /* * Initialize a private initialization info structure for later use. * It must be freed by a call to GuiUnloadFrontEnd or GuiInitFrontEnd. */ GuiInitInfo = ConsoleAllocHeap(HEAP_ZERO_MEMORY, sizeof(*GuiInitInfo)); if (GuiInitInfo == NULL) return STATUS_NO_MEMORY; /* Initialize GUI terminal emulator common functionalities */ if (!GuiInit(ConsoleInitInfo, ConsoleLeaderProcessHandle, GuiInitInfo)) { ConsoleFreeHeap(GuiInitInfo); return STATUS_UNSUCCESSFUL; } /* * Load terminal settings */ #if 0 /* Impersonate the caller in order to retrieve settings in its context */ // if (!CsrImpersonateClient(NULL)) // return STATUS_UNSUCCESSFUL; CsrImpersonateClient(NULL); /* 1. Load the default settings */ GuiConsoleGetDefaultSettings(&GuiInitInfo->TermInfo); #endif GuiInitInfo->TermInfo.ShowWindow = SW_SHOWNORMAL; if (ConsoleInitInfo->IsWindowVisible) { /* 2. Load the remaining console settings via the registry */ if ((ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0) { #if 0 /* Load the terminal infos from the registry */ GuiConsoleReadUserSettings(&GuiInitInfo->TermInfo); #endif /* * Now, update them with the properties the user might gave to us * via the STARTUPINFO structure before calling CreateProcess * (and which was transmitted via the ConsoleStartInfo structure). * We therefore overwrite the values read in the registry. */ if (ConsoleStartInfo->dwStartupFlags & STARTF_USESHOWWINDOW) { GuiInitInfo->TermInfo.ShowWindow = ConsoleStartInfo->wShowWindow; } if (ConsoleStartInfo->dwStartupFlags & STARTF_USEPOSITION) { ConsoleInfo->AutoPosition = FALSE; ConsoleInfo->WindowPosition.x = ConsoleStartInfo->dwWindowOrigin.X; ConsoleInfo->WindowPosition.y = ConsoleStartInfo->dwWindowOrigin.Y; } if (ConsoleStartInfo->dwStartupFlags & STARTF_RUNFULLSCREEN) { ConsoleInfo->FullScreen = TRUE; } } } #if 0 /* Revert impersonation */ CsrRevertToSelf(); #endif // Font data wcsncpy(GuiInitInfo->TermInfo.FaceName, ConsoleInfo->FaceName, LF_FACESIZE); GuiInitInfo->TermInfo.FaceName[LF_FACESIZE - 1] = UNICODE_NULL; GuiInitInfo->TermInfo.FontFamily = ConsoleInfo->FontFamily; GuiInitInfo->TermInfo.FontSize = ConsoleInfo->FontSize; GuiInitInfo->TermInfo.FontWeight = ConsoleInfo->FontWeight; // Display GuiInitInfo->TermInfo.FullScreen = ConsoleInfo->FullScreen; // GuiInitInfo->TermInfo.ShowWindow; GuiInitInfo->TermInfo.AutoPosition = ConsoleInfo->AutoPosition; GuiInitInfo->TermInfo.WindowOrigin = ConsoleInfo->WindowPosition; /* Initialize the icon handles */ // if (ConsoleStartInfo->hIcon != NULL) GuiInitInfo->hIcon = ConsoleStartInfo->hIcon; // else // GuiInitInfo->hIcon = ghDefaultIcon; // if (ConsoleStartInfo->hIconSm != NULL) GuiInitInfo->hIconSm = ConsoleStartInfo->hIconSm; // else // GuiInitInfo->hIconSm = ghDefaultIconSm; // ASSERT(GuiInitInfo->hIcon && GuiInitInfo->hIconSm); GuiInitInfo->IsWindowVisible = ConsoleInitInfo->IsWindowVisible; /* Finally, initialize the frontend structure */ FrontEnd->Vtbl = &GuiVtbl; FrontEnd->Context = NULL; FrontEnd->Context2 = GuiInitInfo; return STATUS_SUCCESS; }