diff --git a/oss/libpopcnt/libpopcnt.h b/oss/libpopcnt/libpopcnt.h index ffcd976b03..de24253d9a 100644 --- a/oss/libpopcnt/libpopcnt.h +++ b/oss/libpopcnt/libpopcnt.h @@ -95,7 +95,7 @@ #define HAVE_AVX512 #endif -#if defined(X86_OR_X64) +#if defined(X86_OR_X64) && !defined(_M_ARM64EC) /* MSVC compatible compilers (Windows) */ #if defined(_MSC_VER) /* clang-cl (LLVM 10 from 2020) requires /arch:AVX2 or diff --git a/src/host/exe/exemain.cpp b/src/host/exe/exemain.cpp index 7aaa45271d..a30680a40a 100644 --- a/src/host/exe/exemain.cpp +++ b/src/host/exe/exemain.cpp @@ -276,7 +276,7 @@ int CALLBACK wWinMain( { // Only try to register as a handoff target if we are NOT a part of Windows. #if TIL_FEATURE_RECEIVEINCOMINGHANDOFF_ENABLED - if (args.ShouldRunAsComServer() && Microsoft::Console::Internal::DefaultApp::CheckDefaultAppPolicy()) + if (args.ShouldRunAsComServer()) { try { diff --git a/src/host/ft_host/sources b/src/host/ft_host/sources index beeba4e675..ba6cf411af 100644 --- a/src/host/ft_host/sources +++ b/src/host/ft_host/sources @@ -55,4 +55,5 @@ TARGETLIBS = \ DELAYLOAD = \ $(DELAYLOAD) \ + icu.dll; \ ext-ms-win-rtcore-ntuser-dpi-l1.dll; \ diff --git a/src/host/ft_host/sources.dep b/src/host/ft_host/sources.dep index 11b0599b17..bc61c95c6b 100644 --- a/src/host/ft_host/sources.dep +++ b/src/host/ft_host/sources.dep @@ -1,6 +1,3 @@ BUILD_PASS1_CONSUMES= \ onecore\windows\vcpkg|PASS1 \ -BUILD_PASS2_CONSUMES= \ - onecore\windows\core\console\open\src\tools\nihilist|PASS2 \ - diff --git a/src/host/ft_integrity/IntegrityTest.cpp b/src/host/ft_integrity/IntegrityTest.cpp index c7a8472617..0ca45b0b5d 100644 --- a/src/host/ft_integrity/IntegrityTest.cpp +++ b/src/host/ft_integrity/IntegrityTest.cpp @@ -214,14 +214,14 @@ void IntegrityTest::_TestValidationHelper(const bool fIsBlockExpected, GetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbiex); - LOG_OUTPUT(L"Buffer Size X:%d Y:%d", csbiex.dwSize.width, csbiex.dwSize.height); + LOG_OUTPUT(L"Buffer Size X:%d Y:%d", csbiex.dwSize.X, csbiex.dwSize.Y); - size_t cch = csbiex.dwSize.width; + size_t cch = csbiex.dwSize.X; wistd::unique_ptr stringData = wil::make_unique_nothrow(cch); THROW_IF_NULL_ALLOC(stringData); COORD coordRead = { 0 }; - for (coordRead.y = 0; coordRead.y < 8; coordRead.y++) + for (coordRead.Y = 0; coordRead.Y < 8; coordRead.Y++) { ZeroMemory(stringData.get(), sizeof(wchar_t) * cch); @@ -237,7 +237,7 @@ void IntegrityTest::_TestValidationHelper(const bool fIsBlockExpected, WEX::Common::String strActual; // At position 0, check the integrity. - if (coordRead.y == 0) + if (coordRead.Y == 0) { strExpected = pwszIntegrityExpected; } @@ -246,11 +246,11 @@ void IntegrityTest::_TestValidationHelper(const bool fIsBlockExpected, // For the rest, check whether the API call worked. if (fIsBlockExpected) { - strExpected = _rgpwszExpectedFail[coordRead.y - 1]; + strExpected = _rgpwszExpectedFail[coordRead.Y - 1]; } else { - strExpected = _rgpwszExpectedSuccess[coordRead.y - 1]; + strExpected = _rgpwszExpectedSuccess[coordRead.Y - 1]; } } stringData[strExpected.GetLength()] = L'\0'; @@ -312,7 +312,7 @@ PCWSTR IntegrityTest::s_GetMyIntegrityLevel() DWORD dwIntegrityLevel = 0; // Get the Integrity level. - wistd::unique_ptr tokenLabel; + wil::unique_tokeninfo_ptr tokenLabel; THROW_IF_FAILED(wil::GetTokenInformationNoThrow(tokenLabel, GetCurrentProcessToken())); dwIntegrityLevel = *GetSidSubAuthority(tokenLabel->Label.Sid, diff --git a/src/host/ft_integrity/sources b/src/host/ft_integrity/sources index a7eddd8bef..0dcd996d5c 100644 --- a/src/host/ft_integrity/sources +++ b/src/host/ft_integrity/sources @@ -33,7 +33,6 @@ INCLUDES=\ $(COM_INC_PATH); \ $(ONECOREBASE_INTERNAL_INC_PATH_L)\appmodel\test\common; \ $(ONECOREREDIST_INTERNAL_INC_PATH_L)\TAEF; \ - $(ONECORE_PRIV_SDK_INC_PATH); \ $(MINCORE_INTERNAL_PRIV_SDK_INC_PATH_L); \ TARGETLIBS=\ diff --git a/src/host/ft_integrity/sources.dep b/src/host/ft_integrity/sources.dep deleted file mode 100644 index 83c5a0a70e..0000000000 --- a/src/host/ft_integrity/sources.dep +++ /dev/null @@ -1,6 +0,0 @@ -PUBLIC_PASS1_CONSUMES= \ - onecore\base\appmodel\test\common\testhelper\winrt\private|PASS1 \ - -BUILD_PASS2_CONSUMES= \ - onecore\base\appmodel\test\common\testhelper\samples\nativecxapp\appx|PASS2 \ - diff --git a/src/host/sources.inc b/src/host/sources.inc index 40417bc775..262aae1679 100644 --- a/src/host/sources.inc +++ b/src/host/sources.inc @@ -197,6 +197,7 @@ DELAYLOAD = \ DXGI.dll; \ OLEAUT32.dll; \ PROPSYS.dll; \ + icu.dll; \ api-ms-win-core-com-l1.dll; \ api-ms-win-core-registry-l2.dll; \ api-ms-win-mm-playsound-l1.dll; \ diff --git a/src/host/srvinit.cpp b/src/host/srvinit.cpp index 284f448382..afb505ad14 100644 --- a/src/host/srvinit.cpp +++ b/src/host/srvinit.cpp @@ -64,7 +64,7 @@ try // Check if this conhost is allowed to delegate its activities to another. // If so, look up the registered default console handler. - if (Globals.delegationPair.IsUndecided() && Microsoft::Console::Internal::DefaultApp::CheckDefaultAppPolicy()) + if (Globals.delegationPair.IsUndecided()) { Globals.delegationPair = DelegationConfig::s_GetDelegationPair(); @@ -82,7 +82,7 @@ try // If we looked up the registered defterm pair, and it was left as the default (missing or {0}), // AND velocity is enabled for DxD, then we switch the delegation pair to Terminal and // mark that we should check that class for the marker interface later. - if (Globals.delegationPair.IsDefault() && Microsoft::Console::Internal::DefaultApp::CheckShouldTerminalBeDefault()) + if (Globals.delegationPair.IsDefault()) { Globals.delegationPair = DelegationConfig::TerminalDelegationPair; Globals.defaultTerminalMarkerCheckRequired = true; diff --git a/src/inc/HostAndPropsheetIncludes.h b/src/inc/HostAndPropsheetIncludes.h index 2a8d588b30..d0480421df 100644 --- a/src/inc/HostAndPropsheetIncludes.h +++ b/src/inc/HostAndPropsheetIncludes.h @@ -14,7 +14,9 @@ #include #undef WIN32_NO_STATUS +#ifndef NO_WINTERNL_INBOX_BUILD #include +#endif #pragma warning(push) #pragma warning(disable:4430) // Must disable 4430 "default int" warning for C++ because ntstatus.h is inflexible SDK definition. diff --git a/src/inc/LibraryIncludes.h b/src/inc/LibraryIncludes.h index 7a7ec3a6a5..511e4d4d95 100644 --- a/src/inc/LibraryIncludes.h +++ b/src/inc/LibraryIncludes.h @@ -18,7 +18,9 @@ // Block minwindef.h min/max macros to prevent conflict #define NOMINMAX // Exclude rarely-used stuff from Windows headers +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #include @@ -65,6 +67,7 @@ // GSL // Block GSL Multi Span include because it both has C++17 deprecated iterators // and uses the C-namespaced "max" which conflicts with Windows definitions. +#include #include #include diff --git a/src/inc/conint.h b/src/inc/conint.h index 495b390f2b..5430c5c1de 100644 --- a/src/inc/conint.h +++ b/src/inc/conint.h @@ -39,10 +39,4 @@ namespace Microsoft::Console::Internal { [[nodiscard]] HRESULT TrySetDarkMode(HWND hwnd) noexcept; } - - namespace DefaultApp - { - [[nodiscard]] bool CheckDefaultAppPolicy() noexcept; - [[nodiscard]] bool CheckShouldTerminalBeDefault() noexcept; - } } diff --git a/src/interactivity/onecore/precomp.h b/src/interactivity/onecore/precomp.h index 7a19e74643..6883aa0972 100644 --- a/src/interactivity/onecore/precomp.h +++ b/src/interactivity/onecore/precomp.h @@ -10,13 +10,16 @@ #include #include #include +#define WIN32_NO_STATUS #include +#undef WIN32_NO_STATUS #include "wchar.h" // Extension presence detection #include #define _DDK_INCLUDED +#define NO_WINTERNL_INBOX_BUILD #include "../../host/precomp.h" #else diff --git a/src/interactivity/win32/ut_interactivity_win32/sources b/src/interactivity/win32/ut_interactivity_win32/sources index 5555077cd8..1f417647e4 100644 --- a/src/interactivity/win32/ut_interactivity_win32/sources +++ b/src/interactivity/win32/ut_interactivity_win32/sources @@ -109,6 +109,7 @@ DELAYLOAD = \ DXGI.dll; \ D3D11.dll; \ OLEAUT32.dll; \ + icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ diff --git a/src/internal/stubs.cpp b/src/internal/stubs.cpp index 3ac946a209..f92f409696 100644 --- a/src/internal/stubs.cpp +++ b/src/internal/stubs.cpp @@ -25,18 +25,3 @@ using namespace Microsoft::Console::Internal; { return S_FALSE; } - -[[nodiscard]] bool DefaultApp::CheckDefaultAppPolicy() noexcept -{ - // True so propsheet will show configuration options but be sure that - // the open one won't attempt handoff from double click of OpenConsole.exe - return true; -} - -[[nodiscard]] bool DefaultApp::CheckShouldTerminalBeDefault() noexcept -{ - // False since setting Terminal as the default app is an OS feature and probably - // should not be done in the open source conhost. We can always decide to turn it - // on in the future though. - return false; -} diff --git a/src/project.inc b/src/project.inc index b604f50ea6..4425c3f804 100644 --- a/src/project.inc +++ b/src/project.inc @@ -32,7 +32,7 @@ USE_NATIVE_EH = 1 USE_STD_CPP20 = 1 MSC_WARNING_LEVEL = /W4 /WX -USER_C_FLAGS = $(USER_C_FLAGS) /fp:contract /utf-8 +USER_C_FLAGS = $(USER_C_FLAGS) /Zc:preprocessor /fp:contract /utf-8 # ------------------------------------- # Common Console Includes and Libraries diff --git a/src/propsheet/OptionsPage.cpp b/src/propsheet/OptionsPage.cpp index a7991565f2..eee80476fe 100644 --- a/src/propsheet/OptionsPage.cpp +++ b/src/propsheet/OptionsPage.cpp @@ -174,6 +174,23 @@ INT_PTR WINAPI SettingsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lPara // Initialize the global handle to this dialog g_hOptionsDlg = hDlg; + { + // Do the check for conhostv1 early, so that we can propagate the new ForceV2 state to everyone. + wil::unique_hmodule conhostV1{ LoadLibraryExW(L"conhostv1.dll", nullptr, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_SEARCH_SYSTEM32) }; + HWND hwndItemToShow, hwndItemToHide; + hwndItemToShow = GetDlgItem(hDlg, IDD_HELP_LEGACY_LINK); + hwndItemToHide = GetDlgItem(hDlg, IDD_HELP_LEGACY_LINK_MISSING); + if (!conhostV1) + { + g_fForceV2 = true; + EnableWindow(GetDlgItem(hDlg, IDD_FORCEV2), FALSE); + std::swap(hwndItemToShow, hwndItemToHide); + } + + ShowWindow(hwndItemToShow, SW_SHOW); + ShowWindow(hwndItemToHide, SW_HIDE); + } + CheckDlgButton(hDlg, IDD_HISTORY_NODUP, gpStateInfo->HistoryNoDup); CheckDlgButton(hDlg, IDD_QUICKEDIT, gpStateInfo->QuickEdit); CheckDlgButton(hDlg, IDD_INSERT, gpStateInfo->InsertMode); @@ -250,7 +267,7 @@ INT_PTR WINAPI SettingsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lPara case WM_NOTIFY: { - if (lParam && (wParam == IDD_HELP_SYSLINK || wParam == IDD_HELP_LEGACY_LINK)) + if (lParam && (wParam == IDD_HELP_SYSLINK || wParam == IDD_HELP_LEGACY_LINK || wParam == IDD_HELP_LEGACY_LINK_MISSING)) { // handle hyperlink click or keyboard activation switch (((LPNMHDR)lParam)->code) diff --git a/src/propsheet/console.cpp b/src/propsheet/console.cpp index 68b146c2e1..d605844059 100644 --- a/src/propsheet/console.cpp +++ b/src/propsheet/console.cpp @@ -96,10 +96,7 @@ void SaveConsoleSettingsIfNeeded(const HWND hwnd) gpStateInfo->FaceName[0] = TEXT('\0'); } - if (Microsoft::Console::Internal::DefaultApp::CheckDefaultAppPolicy()) - { - LOG_IF_FAILED(DelegationConfig::s_SetDefaultByPackage(g_selectedPackage)); - } + LOG_IF_FAILED(DelegationConfig::s_SetDefaultByPackage(g_selectedPackage)); if (gpStateInfo->LinkTitle != nullptr) { @@ -552,14 +549,7 @@ BOOL PopulatePropSheetPageArray(_Out_writes_(cPsps) PROPSHEETPAGE* pPsp, const s { pTerminalPage->dwSize = sizeof(PROPSHEETPAGE); pTerminalPage->hInstance = ghInstance; - if (Microsoft::Console::Internal::DefaultApp::CheckDefaultAppPolicy()) - { - pTerminalPage->pszTemplate = MAKEINTRESOURCE(DID_TERMINAL_WITH_DEFTERM); - } - else - { - pTerminalPage->pszTemplate = MAKEINTRESOURCE(DID_TERMINAL); - } + pTerminalPage->pszTemplate = MAKEINTRESOURCE(DID_TERMINAL_WITH_DEFTERM); pTerminalPage->pfnDlgProc = TerminalDlgProc; pTerminalPage->lParam = TERMINAL_PAGE_INDEX; pTerminalPage->dwFlags = PSP_DEFAULT; @@ -629,10 +619,7 @@ INT_PTR ConsolePropertySheet(__in HWND hWnd, __in PCONSOLE_STATE_INFO pStateInfo // Find the available default console/terminal packages // - if (Microsoft::Console::Internal::DefaultApp::CheckDefaultAppPolicy()) - { - LOG_IF_FAILED(DelegationConfig::s_GetAvailablePackages(g_availablePackages, g_selectedPackage)); - } + LOG_IF_FAILED(DelegationConfig::s_GetAvailablePackages(g_availablePackages, g_selectedPackage)); // // Get the current page number diff --git a/src/propsheet/console.rc b/src/propsheet/console.rc index 18f3077d49..368144c9fd 100644 --- a/src/propsheet/console.rc +++ b/src/propsheet/console.rc @@ -85,6 +85,9 @@ BEGIN CONTROL "&Use legacy console (requires relaunch, affects all consoles)", IDD_FORCEV2, "Button", BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP, 10, 199, 200, 10 + CONTROL "The legacy console is not installed. Learn more.", + IDD_HELP_LEGACY_LINK_MISSING, "SysLink", WS_TABSTOP, 21, 211, 179, 10 + CONTROL "Learn more about legacy console mode", IDD_HELP_LEGACY_LINK, "SysLink", WS_TABSTOP, 21, 211, 179, 10 @@ -148,6 +151,9 @@ BEGIN CONTROL "&Use legacy console (requires relaunch, affects all consoles)", IDD_FORCEV2, "Button", BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP, 10, 199, 200, 10 + CONTROL "The legacy console is not installed. Learn more.", + IDD_HELP_LEGACY_LINK_MISSING, "SysLink", WS_TABSTOP, 21, 211, 179, 10 + CONTROL "Learn more about legacy console mode", IDD_HELP_LEGACY_LINK, "SysLink", WS_TABSTOP, 21, 211, 179, 10 diff --git a/src/propsheet/dialogs.h b/src/propsheet/dialogs.h index 9200f9090e..41b5ec8fe6 100644 --- a/src/propsheet/dialogs.h +++ b/src/propsheet/dialogs.h @@ -129,6 +129,7 @@ Revision History: #define IDD_OPACITY_VALUE 514 #define IDD_INTERCEPT_COPY_PASTE 515 #define IDD_HELP_LEGACY_LINK 516 +#define IDD_HELP_LEGACY_LINK_MISSING 517 #define DID_TERMINAL 600 diff --git a/src/propsheet/misc.cpp b/src/propsheet/misc.cpp index 9d8abcaf05..054eef9612 100644 --- a/src/propsheet/misc.cpp +++ b/src/propsheet/misc.cpp @@ -398,6 +398,10 @@ CreateBoldFont: /* * Store the font info */ + if (FontInfo[nFont].hFont != nullptr) + { + DeleteObject(FontInfo[nFont].hFont); + } FontInfo[nFont].hFont = hFont; FontInfo[nFont].Family = tmFamily; FontInfo[nFont].Size = SizeActual; diff --git a/src/terminal/adapter/ut_adapter/sources b/src/terminal/adapter/ut_adapter/sources index 6039eb87de..8b931860d9 100644 --- a/src/terminal/adapter/ut_adapter/sources +++ b/src/terminal/adapter/ut_adapter/sources @@ -104,6 +104,7 @@ DELAYLOAD = \ DXGI.dll; \ D3D11.dll; \ OLEAUT32.dll; \ + icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ @@ -142,7 +143,6 @@ DLOAD_ERROR_HANDLER = kernelbase #INCLUDES = $(INCLUDES); \ # ..\..\..\inc; \ -# $(SDKTOOLS_INC_PATH)\WexTest\Cue; \ # #SOURCES = $(SOURCES) \ # diff --git a/src/terminal/parser/ut_parser/sources b/src/terminal/parser/ut_parser/sources index bd395a6a29..d4da3cf1d4 100644 --- a/src/terminal/parser/ut_parser/sources +++ b/src/terminal/parser/ut_parser/sources @@ -95,6 +95,7 @@ DELAYLOAD = \ DXGI.dll; \ D3D11.dll; \ OLEAUT32.dll; \ + icu.dll; \ api-ms-win-mm-playsound-l1.dll; \ api-ms-win-shcore-scaling-l1.dll; \ api-ms-win-shell-dataobject-l1.dll; \ diff --git a/src/tools/integrity/lib/util.cpp b/src/tools/integrity/lib/util.cpp index 3ea8e4c6e9..557ce8061b 100644 --- a/src/tools/integrity/lib/util.cpp +++ b/src/tools/integrity/lib/util.cpp @@ -14,7 +14,7 @@ PCWSTR GetIntegrityLevel() DWORD dwIntegrityLevel = 0; // Get the Integrity level. - wistd::unique_ptr tokenLabel; + wil::unique_tokeninfo_ptr tokenLabel; THROW_IF_FAILED(wil::GetTokenInformationNoThrow(tokenLabel, GetCurrentProcessToken())); dwIntegrityLevel = *GetSidSubAuthority(tokenLabel->Label.Sid, diff --git a/src/tools/vtapp/sources.dep b/src/tools/vtapp/sources.dep deleted file mode 100644 index 5aef2e2c5c..0000000000 --- a/src/tools/vtapp/sources.dep +++ /dev/null @@ -1,3 +0,0 @@ -PUBLIC_PASS0_CONSUMES= \ - onecore\redist\mspartners\netfx45\core\binary_release|PASS0 \ - diff --git a/src/tsf/sources b/src/tsf/sources index d18e015d2c..54c7916209 100644 --- a/src/tsf/sources +++ b/src/tsf/sources @@ -53,7 +53,6 @@ SOURCES = \ INCLUDES = \ $(INCLUDES); \ ..\inc; \ - $(ONECORE_PRIV_SDK_INC_PATH); \ $(MINWIN_INTERNAL_PRIV_SDK_INC_PATH_L); \ $(SDK_INC_PATH)\atl30; \ $(ONECORE_EXTERNAL_SDK_INC_PATH)\atl30; \ diff --git a/src/types/sources.inc b/src/types/sources.inc index 6527fbed57..44f252a2a1 100644 --- a/src/types/sources.inc +++ b/src/types/sources.inc @@ -31,7 +31,6 @@ SOURCES= \ ..\CodepointWidthDetector.cpp \ ..\ColorFix.cpp \ ..\GlyphWidth.cpp \ - ..\ModifierKeyState.cpp \ ..\Viewport.cpp \ ..\convert.cpp \ ..\colorTable.cpp \