mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-12 09:11:01 +00:00
Compare commits
2 Commits
dev/lhecke
...
dev/duhowe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb6d4aa402 | ||
|
|
c7a1b257f2 |
@@ -30,7 +30,6 @@ using Microsoft::Console::Interactivity::ServiceLocator;
|
||||
// - <none>
|
||||
void WriteToScreen(SCREEN_INFORMATION& screenInfo, const Viewport& region)
|
||||
{
|
||||
DBGOUTPUT(("WriteToScreen\n"));
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
// update to screen, if we're not iconic.
|
||||
if (!screenInfo.IsActiveScreenBuffer() || WI_IsFlagSet(gci.Flags, CONSOLE_IS_ICONIC))
|
||||
|
||||
@@ -104,8 +104,6 @@ ULONG CONSOLE_INFORMATION::GetCSRecursionCount() const noexcept
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
RIPMSG1(RIP_WARNING, "Console init failed with status 0x%x", Status);
|
||||
|
||||
delete gci.ScreenBuffers;
|
||||
gci.ScreenBuffers = nullptr;
|
||||
|
||||
|
||||
@@ -37,22 +37,10 @@ void InitSideBySide()
|
||||
|
||||
const auto hActCtx = CreateActCtxW(&actctx);
|
||||
|
||||
// The error value is INVALID_HANDLE_VALUE.
|
||||
// ACTCTX_FLAG_SET_PROCESS_DEFAULT has nothing to return upon success, so it returns nullptr.
|
||||
// There is nothing to cleanup upon ACTCTX_FLAG_SET_PROCESS_DEFAULT success, the data
|
||||
// is referenced in the PEB, and lasts till process shutdown.
|
||||
if (hActCtx == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
const auto error = GetLastError();
|
||||
|
||||
// OpenConsole ships with a single manifest at ID 1, while conhost ships with 2 at ID 1
|
||||
// and IDR_SYSTEM_MANIFEST. If we call CreateActCtxW() with IDR_SYSTEM_MANIFEST inside
|
||||
// OpenConsole anyways, nothing happens and we get ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET.
|
||||
if (ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET != error)
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "InitSideBySide failed create an activation context. Error: %d\r\n", error);
|
||||
}
|
||||
}
|
||||
std::ignore = hActCtx;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
||||
@@ -211,10 +211,6 @@ void HandleMenuEvent(const DWORD wParam)
|
||||
try
|
||||
{
|
||||
EventsWritten = gci.pInputBuffer->Write(std::make_unique<MenuEvent>(wParam));
|
||||
if (EventsWritten != 1)
|
||||
{
|
||||
RIPMSG0(RIP_WARNING, "PutInputInBuffer: EventsWritten != 1, 1 expected");
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -237,7 +233,7 @@ void HandleCtrlEvent(const DWORD EventType)
|
||||
gci.CtrlFlags |= CONSOLE_CTRL_CLOSE_FLAG;
|
||||
break;
|
||||
default:
|
||||
RIPMSG1(RIP_ERROR, "Invalid EventType: 0x%x", EventType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,6 @@ int ConvertToOem(const UINT uiCodePage,
|
||||
const UINT cchTarget) noexcept
|
||||
{
|
||||
FAIL_FAST_IF(!(pwchSource != (LPWSTR)pchTarget));
|
||||
DBGCHARS(("ConvertToOem U->%d %.*ls\n", uiCodePage, cchSource > 10 ? 10 : cchSource, pwchSource));
|
||||
// clang-format off
|
||||
#pragma prefast(suppress: __WARNING_W2A_BEST_FIT, "WC_NO_BEST_FIT_CHARS doesn't work in many codepages. Retain old behavior.")
|
||||
// clang-format on
|
||||
@@ -212,8 +211,6 @@ int ConvertInputToUnicode(const UINT uiCodePage,
|
||||
_Out_writes_(cchTarget) WCHAR* const pwchTarget,
|
||||
const UINT cchTarget) noexcept
|
||||
{
|
||||
DBGCHARS(("ConvertInputToUnicode %d->U %.*s\n", uiCodePage, cchSource > 10 ? 10 : cchSource, pchSource));
|
||||
|
||||
return MultiByteToWideChar(uiCodePage, 0, pchSource, cchSource, pwchTarget, cchTarget);
|
||||
}
|
||||
|
||||
@@ -227,8 +224,6 @@ int ConvertOutputToUnicode(_In_ UINT uiCodePage,
|
||||
FAIL_FAST_IF(!(cchTarget > 0));
|
||||
pwchTarget[0] = L'\0';
|
||||
|
||||
DBGCHARS(("ConvertOutputToUnicode %d->U %.*s\n", uiCodePage, cchSource > 10 ? 10 : cchSource, pchSource));
|
||||
|
||||
if (DoBuffersOverlap(reinterpret_cast<const BYTE* const>(pchSource),
|
||||
cchSource * sizeof(CHAR),
|
||||
reinterpret_cast<const BYTE* const>(pwchTarget),
|
||||
|
||||
@@ -540,10 +540,6 @@ bool COOKED_READ_DATA::ProcessInput(const wchar_t wchOrig,
|
||||
{
|
||||
_originalCursorPosition.y += ScrollY;
|
||||
}
|
||||
else
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "WriteCharsLegacy failed %x", status);
|
||||
}
|
||||
}
|
||||
|
||||
_visibleCharCount += NumSpaces;
|
||||
@@ -618,10 +614,6 @@ bool COOKED_READ_DATA::ProcessInput(const wchar_t wchOrig,
|
||||
_originalCursorPosition.x,
|
||||
WC_INTERACTIVE | WC_KEEP_CURSOR_VISIBLE,
|
||||
nullptr);
|
||||
if (FAILED_NTSTATUS(status))
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "WriteCharsLegacy failed %x", status);
|
||||
}
|
||||
}
|
||||
_bytesRead -= sizeof(WCHAR);
|
||||
_bufPtr -= 1;
|
||||
@@ -733,7 +725,6 @@ bool COOKED_READ_DATA::ProcessInput(const wchar_t wchOrig,
|
||||
&ScrollY);
|
||||
if (FAILED_NTSTATUS(status))
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "WriteCharsLegacy failed 0x%x", status);
|
||||
_bytesRead = 0;
|
||||
return true;
|
||||
}
|
||||
@@ -784,10 +775,6 @@ bool COOKED_READ_DATA::ProcessInput(const wchar_t wchOrig,
|
||||
_originalCursorPosition.x,
|
||||
WC_INTERACTIVE | WC_KEEP_CURSOR_VISIBLE,
|
||||
nullptr);
|
||||
if (FAILED_NTSTATUS(status))
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "WriteCharsLegacy failed 0x%x", status);
|
||||
}
|
||||
}
|
||||
_bytesRead += sizeof(WCHAR);
|
||||
_bufPtr++;
|
||||
|
||||
@@ -1421,7 +1421,6 @@ bool SCREEN_INFORMATION::IsMaximizedY() const
|
||||
{
|
||||
if ((USHORT)coordNewScreenSize.width >= SHORT_MAX || (USHORT)coordNewScreenSize.height >= SHORT_MAX)
|
||||
{
|
||||
RIPMSG2(RIP_WARNING, "Invalid screen buffer size (0x%x, 0x%x)", coordNewScreenSize.width, coordNewScreenSize.height);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1050,7 +1050,6 @@ DWORD WINAPI ConsoleIoThread(LPVOID lpParameter)
|
||||
// This will not return. Terminate immediately when disconnected.
|
||||
ServiceLocator::RundownAndExit(STATUS_SUCCESS);
|
||||
}
|
||||
RIPMSG1(RIP_WARNING, "DeviceIoControl failed with Result 0x%x", hr);
|
||||
ReplyMsg = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -527,31 +527,6 @@ void Telemetry::WriteFinalTraceLog()
|
||||
}
|
||||
}
|
||||
|
||||
// These are legacy error messages with limited value, so don't send them back as telemetry.
|
||||
void Telemetry::LogRipMessage(_In_z_ const char* pszMessage, ...) const
|
||||
{
|
||||
// Code needed for passing variable parameters to the vsprintf function.
|
||||
va_list args;
|
||||
va_start(args, pszMessage);
|
||||
char szMessageEvaluated[200] = "";
|
||||
auto cCharsWritten = vsprintf_s(szMessageEvaluated, ARRAYSIZE(szMessageEvaluated), pszMessage, args);
|
||||
va_end(args);
|
||||
|
||||
#if DBG
|
||||
OutputDebugStringA(szMessageEvaluated);
|
||||
#endif
|
||||
|
||||
if (cCharsWritten > 0)
|
||||
{
|
||||
// clang-format off
|
||||
#pragma prefast(suppress: __WARNING_NONCONST_LOCAL, "Activity can't be const, since it's set to a random value on startup.")
|
||||
// clang-format on
|
||||
TraceLoggingWriteTagged(_activity,
|
||||
"RipMessage",
|
||||
TraceLoggingString(szMessageEvaluated, "Message"));
|
||||
}
|
||||
}
|
||||
|
||||
bool Telemetry::IsUserInteractive()
|
||||
{
|
||||
return _fUserInteractiveForTelemetry;
|
||||
|
||||
@@ -49,8 +49,6 @@ public:
|
||||
void FindDialogClosed();
|
||||
void WriteFinalTraceLog();
|
||||
|
||||
void LogRipMessage(_In_z_ const char* pszMessage, ...) const;
|
||||
|
||||
bool IsUserInteractive();
|
||||
|
||||
// Names are from the external API call names. Note that some names can be different
|
||||
@@ -182,11 +180,3 @@ private:
|
||||
unsigned int _uiQuickEditPasteProcUsed;
|
||||
unsigned int _uiQuickEditPasteRawUsed;
|
||||
};
|
||||
|
||||
// Log the RIPMSG through telemetry, and also through a normal OutputDebugStringW call.
|
||||
// These are drop-in substitutes for the RIPMSG0-4 macros from /windows/Core/ntcon2/conhost/consrv.h
|
||||
#define RIPMSG0(flags, msg) Telemetry::Instance().LogRipMessage(msg);
|
||||
#define RIPMSG1(flags, msg, a) Telemetry::Instance().LogRipMessage(msg, a);
|
||||
#define RIPMSG2(flags, msg, a, b) Telemetry::Instance().LogRipMessage(msg, a, b);
|
||||
#define RIPMSG3(flags, msg, a, b, c) Telemetry::Instance().LogRipMessage(msg, a, b, c);
|
||||
#define RIPMSG4(flags, msg, a, b, c, d) Telemetry::Instance().LogRipMessage(msg, a, b, c, d);
|
||||
|
||||
@@ -14,8 +14,8 @@ enum TraceKeywords
|
||||
{
|
||||
//Font = 0x001, // _DBGFONTS
|
||||
//Font2 = 0x002, // _DBGFONTS2
|
||||
Chars = 0x004, // _DBGCHARS
|
||||
Output = 0x008, // _DBGOUTPUT
|
||||
//Chars = 0x004, // _DBGCHARS
|
||||
//Output = 0x008, // _DBGOUTPUT
|
||||
General = 0x100,
|
||||
Input = 0x200,
|
||||
//API = 0x400, // No longer used
|
||||
|
||||
@@ -21,20 +21,6 @@ Author(s):
|
||||
|
||||
#include "../types/inc/Viewport.hpp"
|
||||
|
||||
#if DBG
|
||||
#define DBGCHARS(_params_) \
|
||||
{ \
|
||||
Tracing::s_TraceChars _params_; \
|
||||
}
|
||||
#define DBGOUTPUT(_params_) \
|
||||
{ \
|
||||
Tracing::s_TraceOutput _params_; \
|
||||
}
|
||||
#else
|
||||
#define DBGCHARS(_params_)
|
||||
#define DBGOUTPUT(_params_)
|
||||
#endif
|
||||
|
||||
#define TraceLoggingConsoleCoord(value, name) \
|
||||
TraceLoggingStruct(2, name), \
|
||||
TraceLoggingInt32(value.X, "X"), \
|
||||
@@ -45,9 +31,6 @@ class Tracing
|
||||
public:
|
||||
static void s_TraceWindowViewport(const Microsoft::Console::Types::Viewport& viewport);
|
||||
|
||||
static void s_TraceChars(_In_z_ const char* pszMessage, ...);
|
||||
static void s_TraceOutput(_In_z_ const char* pszMessage, ...);
|
||||
|
||||
static void s_TraceWindowMessage(const MSG& msg);
|
||||
static void s_TraceInputRecord(const INPUT_RECORD& inputRecord);
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@ void StoreKeyInfo(_In_ PMSG msg)
|
||||
ConsoleKeyInfo[i].wVirtualKeyCode = LOWORD(msg->wParam);
|
||||
ConsoleKeyInfo[i].wVirtualScanCode = (BYTE)(HIWORD(msg->lParam));
|
||||
}
|
||||
else
|
||||
{
|
||||
RIPMSG0(RIP_WARNING, "ConsoleKeyInfo buffer is full");
|
||||
}
|
||||
}
|
||||
|
||||
void RetrieveKeyInfo(_In_ HWND hWnd, _Out_ PWORD pwVirtualKeyCode, _Inout_ PWORD pwVirtualScanCode, _In_ BOOL FreeKeyInfo)
|
||||
|
||||
@@ -325,7 +325,6 @@ void Window::_UpdateSystemMetrics() const
|
||||
if (hWnd == nullptr)
|
||||
{
|
||||
const auto gle = GetLastError();
|
||||
RIPMSG1(RIP_WARNING, "CreateWindow failed with gle = 0x%x", gle);
|
||||
status = NTSTATUS_FROM_WIN32(gle);
|
||||
}
|
||||
|
||||
|
||||
@@ -897,7 +897,6 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
EventFlags = MOUSE_HWHEELED;
|
||||
break;
|
||||
default:
|
||||
RIPMSG1(RIP_ERROR, "Invalid message 0x%x", Message);
|
||||
ButtonFlags = 0;
|
||||
EventFlags = 0;
|
||||
break;
|
||||
@@ -919,11 +918,6 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
EventsWritten = 0;
|
||||
}
|
||||
|
||||
if (EventsWritten != 1)
|
||||
{
|
||||
RIPMSG1(RIP_WARNING, "PutInputInBuffer: EventsWritten != 1 (0x%x), 1 expected", EventsWritten);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -968,7 +962,6 @@ NTSTATUS InitWindowsSubsystem(_Out_ HHOOK* phhook)
|
||||
|
||||
if (FAILED_NTSTATUS(Status))
|
||||
{
|
||||
RIPMSG2(RIP_WARNING, "CreateWindowsWindow failed with status 0x%x, gle = 0x%x", Status, GetLastError());
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,27 +185,6 @@ void Undo(HWND hControlWindow);
|
||||
#define PopupBkColor(pStateInfo) \
|
||||
(AttrToRGB(LOBYTE(pStateInfo->PopupAttributes >> 4)))
|
||||
|
||||
// clang-format off
|
||||
#if DBG
|
||||
#define _DBGFONTS 0x00000001
|
||||
#define _DBGFONTS2 0x00000002
|
||||
#define _DBGCHARS 0x00000004
|
||||
#define _DBGOUTPUT 0x00000008
|
||||
#define _DBGALL 0xFFFFFFFF
|
||||
extern ULONG gDebugFlag;
|
||||
|
||||
#define DBGFONTS(_params_)
|
||||
#define DBGFONTS2(_params_)
|
||||
#define DBGCHARS(_params_)
|
||||
#define DBGOUTPUT(_params_)
|
||||
#else
|
||||
#define DBGFONTS(_params_)
|
||||
#define DBGFONTS2(_params_)
|
||||
#define DBGCHARS(_params_)
|
||||
#define DBGOUTPUT(_params_)
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// Macro definitions that handle codepages
|
||||
//
|
||||
#define CP_US (UINT)437
|
||||
|
||||
@@ -24,10 +24,6 @@ Revision History:
|
||||
#include <ShellScalingAPI.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#if DBG
|
||||
ULONG gDebugFlag = 0;
|
||||
#endif
|
||||
|
||||
#define MAX_FONT_INFO_ALLOC (ULONG_MAX / sizeof(FONT_INFO))
|
||||
|
||||
#define FE_ABANDONFONT 0
|
||||
|
||||
Reference in New Issue
Block a user