Merge remote-tracking branch 'origin/inbox' into release-1.19

This commit is contained in:
Dustin L. Howett 2024-01-29 13:52:43 -06:00
commit e727aaf679
27 changed files with 58 additions and 67 deletions

View File

@ -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

View File

@ -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
{

View File

@ -55,4 +55,5 @@ TARGETLIBS = \
DELAYLOAD = \
$(DELAYLOAD) \
icu.dll; \
ext-ms-win-rtcore-ntuser-dpi-l1.dll; \

View File

@ -1,6 +1,3 @@
BUILD_PASS1_CONSUMES= \
onecore\windows\vcpkg|PASS1 \
BUILD_PASS2_CONSUMES= \
onecore\windows\core\console\open\src\tools\nihilist|PASS2 \

View File

@ -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<wchar_t[]> stringData = wil::make_unique_nothrow<wchar_t[]>(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<TOKEN_MANDATORY_LABEL> tokenLabel;
wil::unique_tokeninfo_ptr<TOKEN_MANDATORY_LABEL> tokenLabel;
THROW_IF_FAILED(wil::GetTokenInformationNoThrow(tokenLabel, GetCurrentProcessToken()));
dwIntegrityLevel = *GetSidSubAuthority(tokenLabel->Label.Sid,

View File

@ -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=\

View File

@ -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 \

View File

@ -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; \

View File

@ -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;

View File

@ -14,7 +14,9 @@
#include <windows.h>
#undef WIN32_NO_STATUS
#ifndef NO_WINTERNL_INBOX_BUILD
#include <winternl.h>
#endif
#pragma warning(push)
#pragma warning(disable:4430) // Must disable 4430 "default int" warning for C++ because ntstatus.h is inflexible SDK definition.

View File

@ -18,7 +18,9 @@
// Block minwindef.h min/max macros to prevent <algorithm> conflict
#define NOMINMAX
// Exclude rarely-used stuff from Windows headers
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <algorithm>
#include <atomic>
@ -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 <gsl/gsl>
#include <gsl/gsl_util>
#include <gsl/pointers>

View File

@ -39,10 +39,4 @@ namespace Microsoft::Console::Internal
{
[[nodiscard]] HRESULT TrySetDarkMode(HWND hwnd) noexcept;
}
namespace DefaultApp
{
[[nodiscard]] bool CheckDefaultAppPolicy() noexcept;
[[nodiscard]] bool CheckShouldTerminalBeDefault() noexcept;
}
}

View File

@ -10,13 +10,16 @@
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#define WIN32_NO_STATUS
#include <windows.h>
#undef WIN32_NO_STATUS
#include "wchar.h"
// Extension presence detection
#include <sysparamsext.h>
#define _DDK_INCLUDED
#define NO_WINTERNL_INBOX_BUILD
#include "../../host/precomp.h"
#else

View File

@ -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; \

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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. <A HREF=""https://go.microsoft.com/fwlink/?linkid=2257470"">Learn more.</A>",
IDD_HELP_LEGACY_LINK_MISSING, "SysLink", WS_TABSTOP, 21, 211, 179, 10
CONTROL "Learn more about <A HREF=""https://go.microsoft.com/fwlink/?LinkId=871150"">legacy console mode</A>",
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. <A HREF=""https://go.microsoft.com/fwlink/?linkid=2257470"">Learn more.</A>",
IDD_HELP_LEGACY_LINK_MISSING, "SysLink", WS_TABSTOP, 21, 211, 179, 10
CONTROL "Learn more about <A HREF=""https://go.microsoft.com/fwlink/?LinkId=871150"">legacy console mode</A>",
IDD_HELP_LEGACY_LINK, "SysLink", WS_TABSTOP, 21, 211, 179, 10

View File

@ -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

View File

@ -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;

View File

@ -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) \
#

View File

@ -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; \

View File

@ -14,7 +14,7 @@ PCWSTR GetIntegrityLevel()
DWORD dwIntegrityLevel = 0;
// Get the Integrity level.
wistd::unique_ptr<TOKEN_MANDATORY_LABEL> tokenLabel;
wil::unique_tokeninfo_ptr<TOKEN_MANDATORY_LABEL> tokenLabel;
THROW_IF_FAILED(wil::GetTokenInformationNoThrow(tokenLabel, GetCurrentProcessToken()));
dwIntegrityLevel = *GetSidSubAuthority(tokenLabel->Label.Sid,

View File

@ -1,3 +0,0 @@
PUBLIC_PASS0_CONSUMES= \
onecore\redist\mspartners\netfx45\core\binary_release|PASS0 \

View File

@ -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; \

View File

@ -31,7 +31,6 @@ SOURCES= \
..\CodepointWidthDetector.cpp \
..\ColorFix.cpp \
..\GlyphWidth.cpp \
..\ModifierKeyState.cpp \
..\Viewport.cpp \
..\convert.cpp \
..\colorTable.cpp \