mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-08 23:31:03 +00:00
Remove conhost telemetry (#16253)
The `Telemetry` class was implemented as a singleton which stood in
my long-term goal to remove all global variables from the project.
Most telemetry captured by it hasn't been looked at for a long time
and just as much is now pointless (e.g.,`_fCtrlPgUpPgDnUsed`).
This removes the code.
## Validation Steps Performed
* Still compiles ✅
This commit is contained in:
1
.github/actions/spelling/expect/expect.txt
vendored
1
.github/actions/spelling/expect/expect.txt
vendored
@@ -1590,7 +1590,6 @@ RIGHTALIGN
|
||||
RIGHTBUTTON
|
||||
riid
|
||||
Rike
|
||||
RIPMSG
|
||||
RIS
|
||||
roadmap
|
||||
robomac
|
||||
|
||||
@@ -104,7 +104,7 @@ ULONG CONSOLE_INFORMATION::GetCSRecursionCount() const noexcept
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
RIPMSG1(RIP_WARNING, "Console init failed with status 0x%x", Status);
|
||||
LOG_NTSTATUS_MSG(Status, "Console init failed");
|
||||
|
||||
delete gci.ScreenBuffers;
|
||||
gci.ScreenBuffers = nullptr;
|
||||
|
||||
@@ -841,7 +841,6 @@ CATCH_RETURN();
|
||||
_In_ PCD_CREATE_OBJECT_INFORMATION Information,
|
||||
_In_ PCONSOLE_CREATESCREENBUFFER_MSG a)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::CreateConsoleScreenBuffer);
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
|
||||
// If any buffer type except the one we support is set, it's invalid.
|
||||
|
||||
@@ -222,6 +222,7 @@ int CALLBACK wWinMain(
|
||||
_In_ PWSTR /*pwszCmdLine*/,
|
||||
_In_ int /*nCmdShow*/)
|
||||
{
|
||||
wil::SetResultLoggingCallback(&Tracing::TraceFailure);
|
||||
Microsoft::Console::Interactivity::ServiceLocator::LocateGlobals().hInstance = hInstance;
|
||||
|
||||
ConsoleCheckDebug();
|
||||
|
||||
@@ -41,7 +41,6 @@ void ApiRoutines::GetConsoleInputModeImpl(InputBuffer& context, ULONG& mode) noe
|
||||
{
|
||||
try
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleMode);
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
LockConsole();
|
||||
auto Unlock = wil::scope_exit([&] { UnlockConsole(); });
|
||||
|
||||
@@ -50,7 +50,7 @@ void InitSideBySide()
|
||||
// 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);
|
||||
LOG_WIN32_MSG(error, "InitSideBySide failed create an activation context.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ void HandleMenuEvent(const DWORD wParam)
|
||||
EventsWritten = gci.pInputBuffer->Write(SynthesizeMenuEvent(wParam));
|
||||
if (EventsWritten != 1)
|
||||
{
|
||||
RIPMSG0(RIP_WARNING, "PutInputInBuffer: EventsWritten != 1, 1 expected");
|
||||
LOG_HR_MSG(E_FAIL, "PutInputInBuffer: EventsWritten != 1, 1 expected");
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
@@ -230,7 +230,7 @@ void HandleCtrlEvent(const DWORD EventType)
|
||||
gci.CtrlFlags |= CONSOLE_CTRL_CLOSE_FLAG;
|
||||
break;
|
||||
default:
|
||||
RIPMSG1(RIP_ERROR, "Invalid EventType: 0x%x", EventType);
|
||||
LOG_HR_MSG(E_INVALIDARG, "Invalid EventType: 0x%x", EventType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1391,7 +1391,7 @@ try
|
||||
{
|
||||
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);
|
||||
LOG_HR_MSG(E_INVALIDARG, "Invalid screen buffer size (0x%x, 0x%x)", coordNewScreenSize.width, coordNewScreenSize.height);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ Selection::KeySelectionEventResult Selection::HandleKeySelectionEvent(const INPU
|
||||
// C-c, C-Ins. C-S-c Is also handled by this case.
|
||||
((ctrlPressed) && (wVirtualKeyCode == 'C' || wVirtualKeyCode == VK_INSERT)))
|
||||
{
|
||||
Telemetry::Instance().SetKeyboardTextEditingUsed();
|
||||
|
||||
// copy selection
|
||||
return Selection::KeySelectionEventResult::CopyToClipboard;
|
||||
}
|
||||
@@ -291,8 +289,6 @@ bool Selection::HandleKeyboardLineSelectionEvent(const INPUT_KEY_INFO* const pIn
|
||||
return false;
|
||||
}
|
||||
|
||||
Telemetry::Instance().SetKeyboardTextSelectionUsed();
|
||||
|
||||
// if we're not currently selecting anything, start a new mouse selection
|
||||
if (!IsInSelectingState())
|
||||
{
|
||||
@@ -704,8 +700,6 @@ bool Selection::_HandleColorSelection(const INPUT_KEY_INFO* const pInputKeyInfo)
|
||||
// Clear the selection and call the search / mark function.
|
||||
ClearSelection();
|
||||
|
||||
Telemetry::Instance().LogColorSelectionUsed();
|
||||
|
||||
const auto& textBuffer = gci.renderData.GetTextBuffer();
|
||||
const auto hits = textBuffer.SearchText(str, true);
|
||||
for (const auto& s : hits)
|
||||
|
||||
@@ -428,11 +428,6 @@ HRESULT ConsoleCreateIoThread(_In_ HANDLE Server,
|
||||
[[maybe_unused]] PCONSOLE_API_MSG connectMessage)
|
||||
try
|
||||
{
|
||||
// Create a telemetry instance here - this singleton is responsible for
|
||||
// setting up the g_hConhostV2EventTraceProvider, which is otherwise not
|
||||
// initialized in the defterm handoff at this point.
|
||||
(void)Telemetry::Instance();
|
||||
|
||||
#if !TIL_FEATURE_RECEIVEINCOMINGHANDOFF_ENABLED
|
||||
TraceLoggingWrite(g_hConhostV2EventTraceProvider,
|
||||
"SrvInit_ReceiveHandoff_Disabled",
|
||||
@@ -865,8 +860,6 @@ PWSTR TranslateConsoleTitle(_In_ PCWSTR pwszConsoleTitle, const BOOL fUnexpand,
|
||||
[[nodiscard]] NTSTATUS ConsoleAllocateConsole(PCONSOLE_API_CONNECTINFO p)
|
||||
{
|
||||
// AllocConsole is outside our codebase, but we should be able to mostly track the call here.
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::AllocConsole);
|
||||
|
||||
auto& g = ServiceLocator::LocateGlobals();
|
||||
|
||||
auto& gci = g.getConsoleInformation();
|
||||
@@ -1050,7 +1043,7 @@ 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);
|
||||
LOG_HR_MSG(hr, "DeviceIoControl failed");
|
||||
ReplyMsg = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2,519 +2,26 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <Intsafe.h>
|
||||
#include "Shlwapi.h"
|
||||
#include "telemetry.hpp"
|
||||
#include <ctime>
|
||||
|
||||
#include "history.h"
|
||||
|
||||
#include "../interactivity/inc/ServiceLocator.hpp"
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(g_hConhostV2EventTraceProvider,
|
||||
"Microsoft.Windows.Console.Host",
|
||||
// {fe1ff234-1f09-50a8-d38d-c44fab43e818}
|
||||
(0xfe1ff234, 0x1f09, 0x50a8, 0xd3, 0x8d, 0xc4, 0x4f, 0xab, 0x43, 0xe8, 0x18),
|
||||
TraceLoggingOptionMicrosoftTelemetry());
|
||||
#pragma warning(push)
|
||||
// Disable 4351 so we can initialize the arrays to 0 without a warning.
|
||||
#pragma warning(disable : 4351)
|
||||
Telemetry::Telemetry() :
|
||||
_uiColorSelectionUsed(0),
|
||||
_tStartedAt(0),
|
||||
_wchProcessFileNames(),
|
||||
// Start at position 1, since the first 2 bytes contain the number of strings.
|
||||
_iProcessFileNamesNext(1),
|
||||
_iProcessConnectedCurrently(SIZE_MAX),
|
||||
_rgiProcessFileNameIndex(),
|
||||
_rguiProcessFileNamesCount(),
|
||||
_rgiAlphabeticalIndex(),
|
||||
_rguiTimesApiUsed(),
|
||||
_rguiTimesApiUsedAnsi(),
|
||||
_uiNumberProcessFileNames(0),
|
||||
_fBashUsed(false),
|
||||
_fKeyboardTextEditingUsed(false),
|
||||
_fKeyboardTextSelectionUsed(false),
|
||||
_fUserInteractiveForTelemetry(false),
|
||||
_fCtrlPgUpPgDnUsed(false),
|
||||
_uiCtrlShiftCProcUsed(0),
|
||||
_uiCtrlShiftCRawUsed(0),
|
||||
_uiCtrlShiftVProcUsed(0),
|
||||
_uiCtrlShiftVRawUsed(0),
|
||||
_uiQuickEditCopyProcUsed(0),
|
||||
_uiQuickEditCopyRawUsed(0),
|
||||
_uiQuickEditPasteProcUsed(0),
|
||||
_uiQuickEditPasteRawUsed(0)
|
||||
|
||||
// This code remains to serve as template if we ever need telemetry for conhost again.
|
||||
// The git history for this file may prove useful.
|
||||
#if 0
|
||||
Telemetry::Telemetry()
|
||||
{
|
||||
time(&_tStartedAt);
|
||||
TraceLoggingRegister(g_hConhostV2EventTraceProvider);
|
||||
TraceLoggingWriteStart(_activity, "ActivityStart");
|
||||
// initialize wil tracelogging
|
||||
wil::SetResultLoggingCallback(&Tracing::TraceFailure);
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
Telemetry::~Telemetry()
|
||||
{
|
||||
TraceLoggingWriteStop(_activity, "ActivityStop");
|
||||
TraceLoggingUnregister(g_hConhostV2EventTraceProvider);
|
||||
}
|
||||
|
||||
void Telemetry::SetUserInteractive()
|
||||
{
|
||||
_fUserInteractiveForTelemetry = true;
|
||||
}
|
||||
|
||||
void Telemetry::SetCtrlPgUpPgDnUsed()
|
||||
{
|
||||
_fCtrlPgUpPgDnUsed = true;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogCtrlShiftCProcUsed()
|
||||
{
|
||||
_uiCtrlShiftCProcUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogCtrlShiftCRawUsed()
|
||||
{
|
||||
_uiCtrlShiftCRawUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogCtrlShiftVProcUsed()
|
||||
{
|
||||
_uiCtrlShiftVProcUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogCtrlShiftVRawUsed()
|
||||
{
|
||||
_uiCtrlShiftVRawUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogQuickEditCopyProcUsed()
|
||||
{
|
||||
_uiQuickEditCopyProcUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogQuickEditCopyRawUsed()
|
||||
{
|
||||
_uiQuickEditCopyRawUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogQuickEditPasteProcUsed()
|
||||
{
|
||||
_uiQuickEditPasteProcUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::LogQuickEditPasteRawUsed()
|
||||
{
|
||||
_uiQuickEditPasteRawUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
// Log usage of the Color Selection option.
|
||||
void Telemetry::LogColorSelectionUsed()
|
||||
{
|
||||
_uiColorSelectionUsed++;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::SetWindowSizeChanged()
|
||||
{
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::SetContextMenuUsed()
|
||||
{
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::SetKeyboardTextSelectionUsed()
|
||||
{
|
||||
_fKeyboardTextSelectionUsed = true;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
void Telemetry::SetKeyboardTextEditingUsed()
|
||||
{
|
||||
_fKeyboardTextEditingUsed = true;
|
||||
SetUserInteractive();
|
||||
}
|
||||
|
||||
// Log an API call was used.
|
||||
void Telemetry::LogApiCall(const ApiCall api, const BOOLEAN fUnicode)
|
||||
{
|
||||
// Initially we thought about passing over a string (ex. "XYZ") and use a dictionary data type to hold the counts.
|
||||
// However we would have to search through the dictionary every time we called this method, so we decided
|
||||
// to use an array which has very quick access times.
|
||||
// The downside is we have to create an enum type, and then convert them to strings when we finally
|
||||
// send out the telemetry, but the upside is we should have very good performance.
|
||||
if (fUnicode)
|
||||
{
|
||||
_rguiTimesApiUsed[api]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rguiTimesApiUsedAnsi[api]++;
|
||||
}
|
||||
}
|
||||
|
||||
// Log an API call was used.
|
||||
void Telemetry::LogApiCall(const ApiCall api)
|
||||
{
|
||||
_rguiTimesApiUsed[api]++;
|
||||
}
|
||||
|
||||
// Tries to find the process name amongst our previous process names by doing a binary search.
|
||||
// The main difference between this and the standard bsearch library call, is that if this
|
||||
// can't find the string, it returns the position the new string should be inserted at. This saves
|
||||
// us from having an additional search through the array, and improves performance.
|
||||
bool Telemetry::FindProcessName(const WCHAR* pszProcessName, _Out_ size_t* iPosition) const
|
||||
{
|
||||
auto iMin = 0;
|
||||
auto iMid = 0;
|
||||
auto iMax = _uiNumberProcessFileNames - 1;
|
||||
auto result = 0;
|
||||
|
||||
while (iMin <= iMax)
|
||||
{
|
||||
iMid = (iMax + iMin) / 2;
|
||||
// Use a case-insensitive comparison. We do support running Linux binaries now, but we haven't seen them connect
|
||||
// as processes, and even if they did, we don't care about the difference in running emacs vs. Emacs.
|
||||
result = _wcsnicmp(pszProcessName, _wchProcessFileNames + _rgiProcessFileNameIndex[_rgiAlphabeticalIndex[iMid]], MAX_PATH);
|
||||
if (result < 0)
|
||||
{
|
||||
iMax = iMid - 1;
|
||||
}
|
||||
else if (result > 0)
|
||||
{
|
||||
iMin = iMid + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Found the string.
|
||||
*iPosition = iMid;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Let them know which position to insert the string at.
|
||||
*iPosition = (result > 0) ? iMid + 1 : iMid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log a process name and number of times it has connected to the console in preparation to send through telemetry.
|
||||
// We were considering sending out a log of telemetry when each process connects, but then the telemetry can get
|
||||
// complicated and spammy, especially since command line utilities like help.exe and where.exe are considered processes.
|
||||
// Don't send telemetry for every time a process connects, as this will help reduce the load on our servers.
|
||||
// Just save the name and count, and send the telemetry before the console exits.
|
||||
void Telemetry::LogProcessConnected(const HANDLE hProcess)
|
||||
{
|
||||
// This is a bit of processing, so don't do it for the 95% of machines that aren't being sampled.
|
||||
if (TraceLoggingProviderEnabled(g_hConhostV2EventTraceProvider, 0, MICROSOFT_KEYWORD_MEASURES))
|
||||
{
|
||||
// Don't initialize wszFilePathAndName, QueryFullProcessImageName does that for us. Use QueryFullProcessImageName instead of
|
||||
// GetProcessImageFileName because we need the path to begin with a drive letter and not a device name.
|
||||
WCHAR wszFilePathAndName[MAX_PATH];
|
||||
DWORD dwSize = ARRAYSIZE(wszFilePathAndName);
|
||||
if (QueryFullProcessImageName(hProcess, 0, wszFilePathAndName, &dwSize))
|
||||
{
|
||||
// Stripping out the path also helps with PII issues in case they launched the program
|
||||
// from a path containing their username.
|
||||
auto pwszFileName = PathFindFileName(wszFilePathAndName);
|
||||
|
||||
size_t iFileName;
|
||||
if (FindProcessName(pwszFileName, &iFileName))
|
||||
{
|
||||
// We already logged this process name, so just increment the count.
|
||||
_iProcessConnectedCurrently = _rgiAlphabeticalIndex[iFileName];
|
||||
_rguiProcessFileNamesCount[_iProcessConnectedCurrently]++;
|
||||
}
|
||||
else if ((_uiNumberProcessFileNames < ARRAYSIZE(_rguiProcessFileNamesCount)) &&
|
||||
(_iProcessFileNamesNext < ARRAYSIZE(_wchProcessFileNames) - 10))
|
||||
{
|
||||
// Check if the MS released bash was used. MS bash is installed under windows\system32, and it's possible somebody else
|
||||
// could be installing their bash into that directory, but not likely. If the user first runs a non-MS bash,
|
||||
// and then runs MS bash, we won't detect the MS bash as running, but it's an acceptable compromise.
|
||||
if (!_fBashUsed && !_wcsnicmp(c_pwszBashExeName, pwszFileName, MAX_PATH))
|
||||
{
|
||||
// We could have gotten the system directory once when this class starts, but we'd have to hold the memory for it
|
||||
// plus we're not sure we'd ever need it, so just get it when we know we're running bash.exe.
|
||||
WCHAR wszSystemDirectory[MAX_PATH] = L"";
|
||||
if (GetSystemDirectory(wszSystemDirectory, ARRAYSIZE(wszSystemDirectory)))
|
||||
{
|
||||
_fBashUsed = (PathIsSameRoot(wszFilePathAndName, wszSystemDirectory) == TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// In order to send out a dynamic array of strings through telemetry, we have to pack the strings into a single WCHAR array.
|
||||
// There currently aren't any helper functions for this, and we have to pack it manually.
|
||||
// To understand the format of the single string, consult the documentation in the traceloggingprovider.h file.
|
||||
if (SUCCEEDED(StringCchCopyW(_wchProcessFileNames + _iProcessFileNamesNext, ARRAYSIZE(_wchProcessFileNames) - _iProcessFileNamesNext - 1, pwszFileName)))
|
||||
{
|
||||
// As each FileName comes in, it's appended to the end. However to improve searching speed, we have an array of indexes
|
||||
// that is alphabetically sorted. We could call qsort, but that would be a waste in performance since we're just adding one string
|
||||
// at a time and we always keep the array sorted, so just shift everything over one.
|
||||
for (size_t n = _uiNumberProcessFileNames; n > iFileName; n--)
|
||||
{
|
||||
_rgiAlphabeticalIndex[n] = _rgiAlphabeticalIndex[n - 1];
|
||||
}
|
||||
|
||||
// Now point to the string, and set the count to 1.
|
||||
_rgiAlphabeticalIndex[iFileName] = _uiNumberProcessFileNames;
|
||||
_rgiProcessFileNameIndex[_uiNumberProcessFileNames] = _iProcessFileNamesNext;
|
||||
_rguiProcessFileNamesCount[_uiNumberProcessFileNames] = 1;
|
||||
_iProcessFileNamesNext += wcslen(pwszFileName) + 1;
|
||||
_iProcessConnectedCurrently = _uiNumberProcessFileNames++;
|
||||
|
||||
// Packed arrays start with a UINT16 value indicating the number of elements in the array.
|
||||
auto pbFileNames = reinterpret_cast<BYTE*>(_wchProcessFileNames);
|
||||
pbFileNames[0] = (BYTE)_uiNumberProcessFileNames;
|
||||
pbFileNames[1] = (BYTE)(_uiNumberProcessFileNames >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This Function sends final Trace log before session closes.
|
||||
// We're primarily sending this telemetry once at the end, and only when the user interacted with the console
|
||||
// so we don't overwhelm our servers by sending a constant stream of telemetry while the console is being used.
|
||||
void Telemetry::WriteFinalTraceLog()
|
||||
{
|
||||
const auto& gci = Microsoft::Console::Interactivity::ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
const auto& renderSettings = gci.GetRenderSettings();
|
||||
// This is a bit of processing, so don't do it for the 95% of machines that aren't being sampled.
|
||||
if (TraceLoggingProviderEnabled(g_hConhostV2EventTraceProvider, 0, MICROSOFT_KEYWORD_MEASURES))
|
||||
{
|
||||
if (_fUserInteractiveForTelemetry)
|
||||
{
|
||||
// Send this back using "measures" since we want a good sampling of our entire userbase.
|
||||
time_t tEndedAt;
|
||||
time(&tEndedAt);
|
||||
// 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,
|
||||
"SessionEnding",
|
||||
TraceLoggingBool(_fBashUsed, "BashUsed"),
|
||||
TraceLoggingBool(_fCtrlPgUpPgDnUsed, "CtrlPgUpPgDnUsed"),
|
||||
TraceLoggingBool(_fKeyboardTextEditingUsed, "KeyboardTextEditingUsed"),
|
||||
TraceLoggingBool(_fKeyboardTextSelectionUsed, "KeyboardTextSelectionUsed"),
|
||||
TraceLoggingUInt32(_uiCtrlShiftCProcUsed, "CtrlShiftCProcUsed"),
|
||||
TraceLoggingUInt32(_uiCtrlShiftCRawUsed, "CtrlShiftCRawUsed"),
|
||||
TraceLoggingUInt32(_uiCtrlShiftVProcUsed, "CtrlShiftVProcUsed"),
|
||||
TraceLoggingUInt32(_uiCtrlShiftVRawUsed, "CtrlShiftVRawUsed"),
|
||||
TraceLoggingUInt32(_uiQuickEditCopyProcUsed, "QuickEditCopyProcUsed"),
|
||||
TraceLoggingUInt32(_uiQuickEditCopyRawUsed, "QuickEditCopyRawUsed"),
|
||||
TraceLoggingUInt32(_uiQuickEditPasteProcUsed, "QuickEditPasteProcUsed"),
|
||||
TraceLoggingUInt32(_uiQuickEditPasteRawUsed, "QuickEditPasteRawUsed"),
|
||||
TraceLoggingBool(gci.GetLinkTitle().length() == 0, "LaunchedFromShortcut"),
|
||||
// Normally we would send out a single array containing the name and count,
|
||||
// but that's difficult to do with our telemetry system, so send out two separate arrays.
|
||||
// Casting to UINT should be fine, since our array size is only 2K.
|
||||
TraceLoggingPackedField(_wchProcessFileNames, static_cast<UINT>(sizeof(WCHAR) * _iProcessFileNamesNext), TlgInUNICODESTRING | TlgInVcount, "ProcessesConnected"),
|
||||
TraceLoggingUInt32Array(_rguiProcessFileNamesCount, _uiNumberProcessFileNames, "ProcessesConnectedCount"),
|
||||
// Send back both starting and ending times separately instead just usage time (ending - starting).
|
||||
// This can help us determine if they were using multiple consoles at the same time.
|
||||
TraceLoggingInt32(static_cast<int>(_tStartedAt), "StartedUsingAtSeconds"),
|
||||
TraceLoggingInt32(static_cast<int>(tEndedAt), "EndedUsingAtSeconds"),
|
||||
TraceLoggingUInt32(_uiColorSelectionUsed, "ColorSelectionUsed"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
// Always send this back. We could only send this back when they click "OK" in the settings dialog, but sending it
|
||||
// back every time should give us a good idea of their current, final settings, and not just only when they change a setting.
|
||||
// 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,
|
||||
"Settings",
|
||||
TraceLoggingBool(gci.GetAutoPosition(), "AutoPosition"),
|
||||
TraceLoggingBool(gci.GetHistoryNoDup(), "HistoryNoDuplicates"),
|
||||
TraceLoggingBool(gci.GetInsertMode(), "InsertMode"),
|
||||
TraceLoggingBool(gci.GetLineSelection(), "LineSelection"),
|
||||
TraceLoggingBool(gci.GetQuickEdit(), "QuickEdit"),
|
||||
TraceLoggingValue(gci.GetWindowAlpha(), "WindowAlpha"),
|
||||
TraceLoggingBool(gci.GetWrapText(), "WrapText"),
|
||||
TraceLoggingUInt32Array((UINT32 const*)renderSettings.GetColorTable().data(), 16, "ColorTable"),
|
||||
TraceLoggingValue(gci.CP, "CodePageInput"),
|
||||
TraceLoggingValue(gci.OutputCP, "CodePageOutput"),
|
||||
TraceLoggingValue(gci.GetFontSize().width, "FontSizeX"),
|
||||
TraceLoggingValue(gci.GetFontSize().height, "FontSizeY"),
|
||||
TraceLoggingValue(gci.GetHotKey(), "HotKey"),
|
||||
TraceLoggingValue(gci.GetScreenBufferSize().width, "ScreenBufferSizeX"),
|
||||
TraceLoggingValue(gci.GetScreenBufferSize().height, "ScreenBufferSizeY"),
|
||||
TraceLoggingValue(gci.GetStartupFlags(), "StartupFlags"),
|
||||
TraceLoggingValue(gci.GetDefaultVirtTermLevel(), "VirtualTerminalLevel"),
|
||||
TraceLoggingValue(gci.GetWindowSize().width, "WindowSizeX"),
|
||||
TraceLoggingValue(gci.GetWindowSize().height, "WindowSizeY"),
|
||||
TraceLoggingValue(gci.GetWindowOrigin().width, "WindowOriginX"),
|
||||
TraceLoggingValue(gci.GetWindowOrigin().height, "WindowOriginY"),
|
||||
TraceLoggingValue(gci.GetFaceName(), "FontName"),
|
||||
TraceLoggingBool(gci.IsAltF4CloseAllowed(), "AllowAltF4Close"),
|
||||
TraceLoggingBool(gci.GetCtrlKeyShortcutsDisabled(), "ControlKeyShortcutsDisabled"),
|
||||
TraceLoggingBool(gci.GetEnableColorSelection(), "EnabledColorSelection"),
|
||||
TraceLoggingBool(gci.GetFilterOnPaste(), "FilterOnPaste"),
|
||||
TraceLoggingBool(gci.GetTrimLeadingZeros(), "TrimLeadingZeros"),
|
||||
TraceLoggingValue(gci.GetLaunchFaceName().data(), "LaunchFontName"),
|
||||
TraceLoggingValue(CommandHistory::s_CountOfHistories(), "CommandHistoriesNumber"),
|
||||
TraceLoggingValue(gci.GetCodePage(), "CodePage"),
|
||||
TraceLoggingValue(gci.GetCursorSize(), "CursorSize"),
|
||||
TraceLoggingValue(gci.GetFontFamily(), "FontFamily"),
|
||||
TraceLoggingValue(gci.GetFontWeight(), "FontWeight"),
|
||||
TraceLoggingValue(gci.GetHistoryBufferSize(), "HistoryBufferSize"),
|
||||
TraceLoggingValue(gci.GetNumberOfHistoryBuffers(), "HistoryBuffersNumber"),
|
||||
TraceLoggingValue(gci.GetScrollScale(), "ScrollScale"),
|
||||
TraceLoggingValue(gci.GetFillAttribute(), "FillAttribute"),
|
||||
TraceLoggingValue(gci.GetPopupFillAttribute(), "PopupFillAttribute"),
|
||||
TraceLoggingValue(gci.GetShowWindow(), "ShowWindow"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
static_assert(sizeof(UINT32) == sizeof(renderSettings.GetColorTable()[0]), "gci.Get16ColorTable()");
|
||||
|
||||
// I could use the TraceLoggingUIntArray, but then we would have to know the order of the enums on the backend.
|
||||
// So just log each enum count separately with its string representation which makes it more human readable.
|
||||
// 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,
|
||||
"ApiUsed",
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[AddConsoleAlias], "AddConsoleAlias"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[AllocConsole], "AllocConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[AttachConsole], "AttachConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[CreateConsoleScreenBuffer], "CreateConsoleScreenBuffer"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GenerateConsoleCtrlEvent], "GenerateConsoleCtrlEvent"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[FillConsoleOutputAttribute], "FillConsoleOutputAttribute"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[FillConsoleOutputCharacter], "FillConsoleOutputCharacter"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[FlushConsoleInputBuffer], "FlushConsoleInputBuffer"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[FreeConsole], "FreeConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleAlias], "GetConsoleAlias"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleAliases], "GetConsoleAliases"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleAliasExesLength], "GetConsoleAliasExesLength"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleAliasesLength], "GetConsoleAliasesLength"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleAliasExes], "GetConsoleAliasExes"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleCP], "GetConsoleCP"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleCursorInfo], "GetConsoleCursorInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleDisplayMode], "GetConsoleDisplayMode"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleFontSize], "GetConsoleFontSize"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleHistoryInfo], "GetConsoleHistoryInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleLangId], "GetConsoleLangId"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleMode], "GetConsoleMode"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleOriginalTitle], "GetConsoleOriginalTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleOutputCP], "GetConsoleOutputCP"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleProcessList], "GetConsoleProcessList"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleScreenBufferInfoEx], "GetConsoleScreenBufferInfoEx"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleSelectionInfo], "GetConsoleSelectionInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleTitle], "GetConsoleTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetConsoleWindow], "GetConsoleWindow"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetCurrentConsoleFontEx], "GetCurrentConsoleFontEx"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetLargestConsoleWindowSize], "GetLargestConsoleWindowSize"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetNumberOfConsoleInputEvents], "GetNumberOfConsoleInputEvents"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[GetNumberOfConsoleMouseButtons], "GetNumberOfConsoleMouseButtons"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[PeekConsoleInput], "PeekConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ReadConsole], "ReadConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ReadConsoleInput], "ReadConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ReadConsoleOutput], "ReadConsoleOutput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ReadConsoleOutputAttribute], "ReadConsoleOutputAttribute"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ReadConsoleOutputCharacter], "ReadConsoleOutputCharacter"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[ScrollConsoleScreenBuffer], "ScrollConsoleScreenBuffer"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleActiveScreenBuffer], "SetConsoleActiveScreenBuffer"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleCP], "SetConsoleCP"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleCursorInfo], "SetConsoleCursorInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleCursorPosition], "SetConsoleCursorPosition"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleDisplayMode], "SetConsoleDisplayMode"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleHistoryInfo], "SetConsoleHistoryInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleMode], "SetConsoleMode"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleOutputCP], "SetConsoleOutputCP"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleScreenBufferInfoEx], "SetConsoleScreenBufferInfoEx"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleScreenBufferSize], "SetConsoleScreenBufferSize"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleTextAttribute], "SetConsoleTextAttribute"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleTitle], "SetConsoleTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetConsoleWindowInfo], "SetConsoleWindowInfo"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[SetCurrentConsoleFontEx], "SetCurrentConsoleFontEx"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[WriteConsole], "WriteConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[WriteConsoleInput], "WriteConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[WriteConsoleOutput], "WriteConsoleOutput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[WriteConsoleOutputAttribute], "WriteConsoleOutputAttribute"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsed[WriteConsoleOutputCharacter], "WriteConsoleOutputCharacter"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
|
||||
for (auto n = 0; n < ARRAYSIZE(_rguiTimesApiUsedAnsi); n++)
|
||||
{
|
||||
if (_rguiTimesApiUsedAnsi[n])
|
||||
{
|
||||
// Ansi specific API's are used less, so check if we have anything to send back.
|
||||
// Also breaking it up into a separate TraceLoggingWriteTagged fixes a compilation warning that
|
||||
// the heap is too small.
|
||||
// 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,
|
||||
"ApiAnsiUsed",
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[AddConsoleAlias], "AddConsoleAlias"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[FillConsoleOutputCharacter], "FillConsoleOutputCharacter"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleAlias], "GetConsoleAlias"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleAliases], "GetConsoleAliases"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleAliasesLength], "GetConsoleAliasesLength"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleAliasExes], "GetConsoleAliasExes"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleAliasExesLength], "GetConsoleAliasExesLength"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleOriginalTitle], "GetConsoleOriginalTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[GetConsoleTitle], "GetConsoleTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[PeekConsoleInput], "PeekConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[ReadConsole], "ReadConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[ReadConsoleInput], "ReadConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[ReadConsoleOutput], "ReadConsoleOutput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[ReadConsoleOutputCharacter], "ReadConsoleOutputCharacter"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[SetConsoleTitle], "SetConsoleTitle"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[WriteConsole], "WriteConsole"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[WriteConsoleInput], "WriteConsoleInput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[WriteConsoleOutput], "WriteConsoleOutput"),
|
||||
TraceLoggingUInt32(_rguiTimesApiUsedAnsi[WriteConsoleOutputCharacter], "WriteConsoleOutputCharacter"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -1,186 +1,17 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- telemetry.hpp
|
||||
|
||||
Abstract:
|
||||
- This module is used for recording all telemetry feedback from the console
|
||||
|
||||
Author(s):
|
||||
- Evan Wirt (EvanWi) 09-Jul-2014
|
||||
- Kourosh Mehrain (KMehrain) 09-Jul-2014
|
||||
- Stephen Somuah (StSomuah) 09-Jul-2014
|
||||
- Anup Manandhar (AnupM) 09-Jul-2014
|
||||
--*/
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
#pragma once
|
||||
|
||||
#include <TraceLoggingActivity.h>
|
||||
|
||||
// This code remains to serve as template if we ever need telemetry for conhost again.
|
||||
// The git history for this file may prove useful.
|
||||
#if 0
|
||||
class Telemetry
|
||||
{
|
||||
public:
|
||||
// Implement this as a singleton class.
|
||||
static Telemetry& Instance()
|
||||
{
|
||||
static Telemetry s_Instance;
|
||||
return s_Instance;
|
||||
}
|
||||
|
||||
void SetUserInteractive();
|
||||
void SetWindowSizeChanged();
|
||||
void SetContextMenuUsed();
|
||||
void SetKeyboardTextSelectionUsed();
|
||||
void SetKeyboardTextEditingUsed();
|
||||
void SetCtrlPgUpPgDnUsed();
|
||||
void LogCtrlShiftCProcUsed();
|
||||
void LogCtrlShiftCRawUsed();
|
||||
void LogCtrlShiftVProcUsed();
|
||||
void LogCtrlShiftVRawUsed();
|
||||
void LogQuickEditCopyProcUsed();
|
||||
void LogQuickEditCopyRawUsed();
|
||||
void LogQuickEditPasteProcUsed();
|
||||
void LogQuickEditPasteRawUsed();
|
||||
void LogColorSelectionUsed();
|
||||
|
||||
void LogProcessConnected(const HANDLE hProcess);
|
||||
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
|
||||
// than the internal API calls.
|
||||
// Don't worry about the following APIs, because they are external to our conhost codebase and hard to track through
|
||||
// telemetry: GetStdHandle, SetConsoleCtrlHandler, SetStdHandle
|
||||
// We can't differentiate between these apis, so just log the "-Ex" versions: GetConsoleScreenBufferInfo / GetConsoleScreenBufferInfoEx,
|
||||
// GetCurrentConsoleFontEx / GetCurrentConsoleFont
|
||||
enum ApiCall
|
||||
{
|
||||
AddConsoleAlias = 0,
|
||||
AllocConsole,
|
||||
AttachConsole,
|
||||
CreateConsoleScreenBuffer,
|
||||
FillConsoleOutputAttribute,
|
||||
FillConsoleOutputCharacter,
|
||||
FlushConsoleInputBuffer,
|
||||
FreeConsole,
|
||||
GenerateConsoleCtrlEvent,
|
||||
GetConsoleAlias,
|
||||
GetConsoleAliases,
|
||||
GetConsoleAliasesLength,
|
||||
GetConsoleAliasExes,
|
||||
GetConsoleAliasExesLength,
|
||||
GetConsoleCP,
|
||||
GetConsoleCursorInfo,
|
||||
GetConsoleDisplayMode,
|
||||
GetConsoleFontSize,
|
||||
GetConsoleHistoryInfo,
|
||||
GetConsoleMode,
|
||||
GetConsoleLangId,
|
||||
GetConsoleOriginalTitle,
|
||||
GetConsoleOutputCP,
|
||||
GetConsoleProcessList,
|
||||
GetConsoleScreenBufferInfoEx,
|
||||
GetConsoleSelectionInfo,
|
||||
GetConsoleTitle,
|
||||
GetConsoleWindow,
|
||||
GetCurrentConsoleFontEx,
|
||||
GetLargestConsoleWindowSize,
|
||||
GetNumberOfConsoleInputEvents,
|
||||
GetNumberOfConsoleMouseButtons,
|
||||
PeekConsoleInput,
|
||||
ReadConsole,
|
||||
ReadConsoleInput,
|
||||
ReadConsoleOutput,
|
||||
ReadConsoleOutputAttribute,
|
||||
ReadConsoleOutputCharacter,
|
||||
ScrollConsoleScreenBuffer,
|
||||
SetConsoleActiveScreenBuffer,
|
||||
SetConsoleCP,
|
||||
SetConsoleCursorInfo,
|
||||
SetConsoleCursorPosition,
|
||||
SetConsoleDisplayMode,
|
||||
SetConsoleHistoryInfo,
|
||||
SetConsoleMode,
|
||||
SetConsoleOutputCP,
|
||||
SetConsoleScreenBufferInfoEx,
|
||||
SetConsoleScreenBufferSize,
|
||||
SetConsoleTextAttribute,
|
||||
SetConsoleTitle,
|
||||
SetConsoleWindowInfo,
|
||||
SetCurrentConsoleFontEx,
|
||||
WriteConsole,
|
||||
WriteConsoleInput,
|
||||
WriteConsoleOutput,
|
||||
WriteConsoleOutputAttribute,
|
||||
WriteConsoleOutputCharacter,
|
||||
// Only use this last enum as a count of the number of api enums.
|
||||
NUMBER_OF_APIS
|
||||
};
|
||||
void LogApiCall(const ApiCall api);
|
||||
void LogApiCall(const ApiCall api, const BOOLEAN fUnicode);
|
||||
|
||||
private:
|
||||
// Used to prevent multiple instances
|
||||
Telemetry();
|
||||
~Telemetry();
|
||||
Telemetry(const Telemetry&);
|
||||
void operator=(const Telemetry&);
|
||||
|
||||
bool FindProcessName(const WCHAR* pszProcessName, _Out_ size_t* iPosition) const;
|
||||
|
||||
static const int c_iMaxProcessesConnected = 100;
|
||||
|
||||
private:
|
||||
TraceLoggingActivity<g_hConhostV2EventTraceProvider> _activity;
|
||||
|
||||
unsigned int _uiColorSelectionUsed;
|
||||
time_t _tStartedAt;
|
||||
WCHAR const* const c_pwszBashExeName = L"bash.exe";
|
||||
|
||||
// The current recommendation is to keep telemetry events 4KB or less, so let's keep our array at less than 2KB (1000 * 2 bytes).
|
||||
WCHAR _wchProcessFileNames[1000];
|
||||
// Index into our specially packed string, where to insert the next string.
|
||||
size_t _iProcessFileNamesNext;
|
||||
// Index for the currently connected process.
|
||||
size_t _iProcessConnectedCurrently;
|
||||
// An array of indexes into the _wchProcessFileNames array, which point to the individual process names.
|
||||
size_t _rgiProcessFileNameIndex[c_iMaxProcessesConnected];
|
||||
// Number of times each process has connected to the console.
|
||||
unsigned int _rguiProcessFileNamesCount[c_iMaxProcessesConnected];
|
||||
// To speed up searching the Process Names, create an alphabetically sorted index.
|
||||
size_t _rgiAlphabeticalIndex[c_iMaxProcessesConnected];
|
||||
unsigned int _rguiTimesApiUsed[NUMBER_OF_APIS];
|
||||
// Most of this array will be empty, and is only used if an API has an ansi specific variant.
|
||||
unsigned int _rguiTimesApiUsedAnsi[NUMBER_OF_APIS];
|
||||
// Total number of file names we've added.
|
||||
UINT16 _uiNumberProcessFileNames;
|
||||
|
||||
bool _fBashUsed;
|
||||
bool _fKeyboardTextEditingUsed;
|
||||
bool _fKeyboardTextSelectionUsed;
|
||||
bool _fUserInteractiveForTelemetry;
|
||||
bool _fCtrlPgUpPgDnUsed;
|
||||
|
||||
// Linux copy and paste keyboard shortcut telemetry
|
||||
unsigned int _uiCtrlShiftCProcUsed;
|
||||
unsigned int _uiCtrlShiftCRawUsed;
|
||||
unsigned int _uiCtrlShiftVProcUsed;
|
||||
unsigned int _uiCtrlShiftVRawUsed;
|
||||
|
||||
// Quick edit copy and paste usage telemetry
|
||||
unsigned int _uiQuickEditCopyProcUsed;
|
||||
unsigned int _uiQuickEditCopyRawUsed;
|
||||
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);
|
||||
#endif
|
||||
|
||||
@@ -194,15 +194,12 @@ void Tracing::s_TraceConsoleAttachDetach(_In_ ConsoleProcessHandle* const pConso
|
||||
{
|
||||
if (TraceLoggingProviderEnabled(g_hConhostV2EventTraceProvider, 0, TraceKeywords::ConsoleAttachDetach))
|
||||
{
|
||||
auto bIsUserInteractive = Telemetry::Instance().IsUserInteractive();
|
||||
|
||||
TraceLoggingWrite(
|
||||
g_hConhostV2EventTraceProvider,
|
||||
"ConsoleAttachDetach",
|
||||
TraceLoggingPid(pConsoleProcessHandle->dwProcessId, "AttachedProcessId"),
|
||||
TraceLoggingFileTime(pConsoleProcessHandle->GetProcessCreationTime(), "AttachedProcessCreationTime"),
|
||||
TraceLoggingBool(bIsAttach, "IsAttach"),
|
||||
TraceLoggingBool(bIsUserInteractive, "IsUserInteractive"),
|
||||
TraceLoggingKeyword(TIL_KEYWORD_TRACE),
|
||||
TraceLoggingKeyword(TraceKeywords::ConsoleAttachDetach));
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void StoreKeyInfo(_In_ PMSG msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
RIPMSG0(RIP_WARNING, "ConsoleKeyInfo buffer is full");
|
||||
LOG_HR_MSG(E_FAIL, "ConsoleKeyInfo buffer is full");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ void Window::_UpdateSystemMetrics() const
|
||||
if (hWnd == nullptr)
|
||||
{
|
||||
const auto gle = GetLastError();
|
||||
RIPMSG1(RIP_WARNING, "CreateWindow failed with gle = 0x%x", gle);
|
||||
LOG_WIN32_MSG(gle, "CreateWindow failed");
|
||||
status = NTSTATUS_FROM_WIN32(gle);
|
||||
}
|
||||
|
||||
@@ -738,8 +738,6 @@ void Window::VerticalScroll(const WORD wScrollCommand, const WORD wAbsoluteChang
|
||||
auto& ScreenInfo = GetScreenInfo();
|
||||
|
||||
// Log a telemetry event saying the user interacted with the Console
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
|
||||
const auto& viewport = ScreenInfo.GetViewport();
|
||||
|
||||
NewOrigin = viewport.Origin();
|
||||
@@ -818,8 +816,6 @@ void Window::VerticalScroll(const WORD wScrollCommand, const WORD wAbsoluteChang
|
||||
void Window::HorizontalScroll(const WORD wScrollCommand, const WORD wAbsoluteChange)
|
||||
{
|
||||
// Log a telemetry event saying the user interacted with the Console
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
|
||||
auto& ScreenInfo = GetScreenInfo();
|
||||
const auto sScreenBufferSizeX = ScreenInfo.GetBufferSize().Width();
|
||||
const auto& viewport = ScreenInfo.GetViewport();
|
||||
|
||||
@@ -135,16 +135,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
const BOOL bKeyDown = WI_IsFlagClear(lParam, KEY_TRANSITION_UP);
|
||||
const bool IsCharacterMessage = (Message == WM_CHAR || Message == WM_SYSCHAR || Message == WM_DEADCHAR || Message == WM_SYSDEADCHAR);
|
||||
|
||||
if (bKeyDown)
|
||||
{
|
||||
// Log a telemetry flag saying the user interacted with the Console
|
||||
// Only log when the key is a down press. Otherwise we're getting many calls with
|
||||
// Message = WM_CHAR, VirtualKeyCode = VK_TAB, with bKeyDown = false
|
||||
// when nothing is happening, or the user has merely clicked on the title bar, and
|
||||
// this can incorrectly mark the session as being interactive.
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
}
|
||||
|
||||
// Make sure we retrieve the key info first, or we could chew up
|
||||
// unneeded space in the key info table if we bail out early.
|
||||
if (IsCharacterMessage)
|
||||
@@ -213,38 +203,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
|
||||
const INPUT_KEY_INFO inputKeyInfo(VirtualKeyCode, ControlKeyState);
|
||||
|
||||
// Capture telemetry on Ctrl+Shift+ C or V commands
|
||||
if (IsInProcessedInputMode())
|
||||
{
|
||||
// Capture telemetry data when a user presses ctrl+shift+c or v in processed mode
|
||||
if (inputKeyInfo.IsShiftAndCtrlOnly())
|
||||
{
|
||||
if (VirtualKeyCode == 'V')
|
||||
{
|
||||
Telemetry::Instance().LogCtrlShiftVProcUsed();
|
||||
}
|
||||
else if (VirtualKeyCode == 'C')
|
||||
{
|
||||
Telemetry::Instance().LogCtrlShiftCProcUsed();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Capture telemetry data when a user presses ctrl+shift+c or v in raw mode
|
||||
if (inputKeyInfo.IsShiftAndCtrlOnly())
|
||||
{
|
||||
if (VirtualKeyCode == 'V')
|
||||
{
|
||||
Telemetry::Instance().LogCtrlShiftVRawUsed();
|
||||
}
|
||||
else if (VirtualKeyCode == 'C')
|
||||
{
|
||||
Telemetry::Instance().LogCtrlShiftCRawUsed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a key up message, should we ignore it? We do this so that if a process reads a line from the input
|
||||
// buffer, the key up event won't get put in the buffer after the read completes.
|
||||
if (gci.Flags & CONSOLE_IGNORE_NEXT_KEYUP)
|
||||
@@ -265,7 +223,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
{
|
||||
case 'V':
|
||||
// the user is attempting to paste from the clipboard
|
||||
Telemetry::Instance().SetKeyboardTextEditingUsed();
|
||||
Clipboard::Instance().Paste();
|
||||
return;
|
||||
}
|
||||
@@ -278,8 +235,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
switch (VirtualKeyCode)
|
||||
{
|
||||
case 'A':
|
||||
// Set Text Selection using keyboard to true for telemetry
|
||||
Telemetry::Instance().SetKeyboardTextSelectionUsed();
|
||||
// the user is asking to select all
|
||||
pSelection->SelectAll();
|
||||
return;
|
||||
@@ -293,8 +248,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
Selection::Instance().InitializeMarkSelection();
|
||||
return;
|
||||
case 'V':
|
||||
// the user is attempting to paste from the clipboard
|
||||
Telemetry::Instance().SetKeyboardTextEditingUsed();
|
||||
Clipboard::Instance().Paste();
|
||||
return;
|
||||
case VK_HOME:
|
||||
@@ -307,10 +260,6 @@ void HandleKeyEvent(const HWND hWnd,
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
case VK_NEXT:
|
||||
Telemetry::Instance().SetCtrlPgUpPgDnUsed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,9 +418,6 @@ BOOL HandleSysKeyEvent(const HWND hWnd, const UINT Message, const WPARAM wParam,
|
||||
VirtualKeyCode = LOWORD(wParam);
|
||||
}
|
||||
|
||||
// Log a telemetry flag saying the user interacted with the Console
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
|
||||
// check for ctrl-esc
|
||||
const auto bCtrlDown = OneCoreSafeGetKeyState(VK_CONTROL) & KEY_PRESSED;
|
||||
|
||||
@@ -568,12 +514,6 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
const LPARAM lParam)
|
||||
{
|
||||
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
if (Message != WM_MOUSEMOVE)
|
||||
{
|
||||
// Log a telemetry flag saying the user interacted with the Console
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
}
|
||||
|
||||
const auto pSelection = &Selection::Instance();
|
||||
|
||||
if (!(gci.Flags & CONSOLE_HAS_FOCUS) && !pSelection->IsMouseButtonDown())
|
||||
@@ -804,31 +744,12 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
{
|
||||
if (pSelection->IsInSelectingState())
|
||||
{
|
||||
// Capture data on when quick edit copy is used in proc or raw mode
|
||||
if (IsInProcessedInputMode())
|
||||
{
|
||||
Telemetry::Instance().LogQuickEditCopyProcUsed();
|
||||
}
|
||||
else
|
||||
{
|
||||
Telemetry::Instance().LogQuickEditCopyRawUsed();
|
||||
}
|
||||
// If the ALT key is held, also select HTML as well as plain text.
|
||||
const auto fAlsoCopyFormatting = WI_IsFlagSet(OneCoreSafeGetKeyState(VK_MENU), KEY_PRESSED);
|
||||
Clipboard::Instance().Copy(fAlsoCopyFormatting);
|
||||
}
|
||||
else if (gci.Flags & CONSOLE_QUICK_EDIT_MODE)
|
||||
{
|
||||
// Capture data on when quick edit paste is used in proc or raw mode
|
||||
if (IsInProcessedInputMode())
|
||||
{
|
||||
Telemetry::Instance().LogQuickEditPasteProcUsed();
|
||||
}
|
||||
else
|
||||
{
|
||||
Telemetry::Instance().LogQuickEditPasteRawUsed();
|
||||
}
|
||||
|
||||
Clipboard::Instance().Paste();
|
||||
}
|
||||
gci.Flags |= CONSOLE_IGNORE_NEXT_MOUSE_INPUT;
|
||||
@@ -911,7 +832,7 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
EventFlags = MOUSE_HWHEELED;
|
||||
break;
|
||||
default:
|
||||
RIPMSG1(RIP_ERROR, "Invalid message 0x%x", Message);
|
||||
LOG_HR_MSG(E_INVALIDARG, "Invalid message 0x%x", Message);
|
||||
ButtonFlags = 0;
|
||||
EventFlags = 0;
|
||||
break;
|
||||
@@ -968,7 +889,7 @@ NTSTATUS InitWindowsSubsystem(_Out_ HHOOK* phhook)
|
||||
|
||||
if (FAILED_NTSTATUS(Status))
|
||||
{
|
||||
RIPMSG2(RIP_WARNING, "CreateWindowsWindow failed with status 0x%x, gle = 0x%x", Status, GetLastError());
|
||||
LOG_NTSTATUS_MSG(Status, "CreateWindowsWindow failed");
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,12 +163,6 @@ using namespace Microsoft::Console::Types;
|
||||
|
||||
case WM_SIZING:
|
||||
{
|
||||
// Signal that the user changed the window size, so we can return the value later for telemetry. By only
|
||||
// sending the data back if the size has changed, helps reduce the amount of telemetry being sent back.
|
||||
// WM_SIZING doesn't fire if they resize the window using Win-UpArrow, so we'll miss that scenario. We could
|
||||
// listen to the WM_SIZE message instead, but they can fire when the window is being restored from being
|
||||
// minimized, and not only when they resize the window.
|
||||
Telemetry::Instance().SetWindowSizeChanged();
|
||||
goto CallDefWin;
|
||||
break;
|
||||
}
|
||||
@@ -322,11 +316,6 @@ using namespace Microsoft::Console::Types;
|
||||
|
||||
case WM_CLOSE:
|
||||
{
|
||||
// Write the final trace log during the WM_CLOSE message while the console process is still fully alive.
|
||||
// This gives us time to query the process for information. We shouldn't really miss any useful
|
||||
// telemetry between now and when the process terminates.
|
||||
Telemetry::Instance().WriteFinalTraceLog();
|
||||
|
||||
_CloseWindow();
|
||||
break;
|
||||
}
|
||||
@@ -471,7 +460,6 @@ using namespace Microsoft::Console::Types;
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
Telemetry::Instance().SetContextMenuUsed();
|
||||
if (DefWindowProcW(hWnd, WM_NCHITTEST, 0, lParam) == HTCLIENT)
|
||||
{
|
||||
auto hHeirMenu = Menu::s_GetHeirMenuHandle();
|
||||
@@ -865,12 +853,6 @@ void Window::_HandleDrop(const WPARAM wParam) const
|
||||
|
||||
if (DragQueryFile((HDROP)wParam, 0, szPath, ARRAYSIZE(szPath)) != 0)
|
||||
{
|
||||
// Log a telemetry flag saying the user interacted with the Console
|
||||
// Only log when DragQueryFile succeeds, because if we don't when the console starts up, we're seeing
|
||||
// _HandleDrop get called multiple times (and DragQueryFile fail),
|
||||
// which can incorrectly mark this console session as interactive.
|
||||
Telemetry::Instance().SetUserInteractive();
|
||||
|
||||
fAddQuotes = (wcschr(szPath, L' ') != nullptr);
|
||||
if (fAddQuotes)
|
||||
{
|
||||
|
||||
@@ -42,12 +42,10 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
|
||||
if (a->Output)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleOutputCP);
|
||||
m->_pApiRoutines->GetConsoleOutputCodePageImpl(a->CodePage);
|
||||
}
|
||||
else
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleCP);
|
||||
m->_pApiRoutines->GetConsoleInputCodePageImpl(a->CodePage);
|
||||
}
|
||||
return S_OK;
|
||||
@@ -56,7 +54,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleMode(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleMode);
|
||||
const auto a = &m->u.consoleMsgL1.GetConsoleMode;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -84,7 +81,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleMode(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleMode);
|
||||
const auto a = &m->u.consoleMsgL1.SetConsoleMode;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -112,7 +108,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetNumberOfInputEvents(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetNumberOfConsoleInputEvents);
|
||||
const auto a = &m->u.consoleMsgL1.GetNumberOfConsoleInputEvents;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -130,15 +125,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
*pbReplyPending = FALSE;
|
||||
|
||||
const auto a = &m->u.consoleMsgL1.GetConsoleInput;
|
||||
if (WI_IsFlagSet(a->Flags, CONSOLE_READ_NOREMOVE))
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::PeekConsoleInput, a->Unicode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsoleInput, a->Unicode);
|
||||
}
|
||||
|
||||
a->NumRecords = 0;
|
||||
|
||||
// If any flags are set that are not within our enum, it's invalid.
|
||||
@@ -229,7 +215,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
*pbReplyPending = FALSE;
|
||||
|
||||
const auto a = &m->u.consoleMsgL1.ReadConsole;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsole, a->Unicode);
|
||||
|
||||
a->NumBytes = 0; // we return 0 until proven otherwise.
|
||||
|
||||
@@ -345,7 +330,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
*pbReplyPending = FALSE;
|
||||
|
||||
const auto a = &m->u.consoleMsgL1.WriteConsole;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsole, a->Unicode);
|
||||
|
||||
// Make sure we have a valid screen buffer.
|
||||
auto HandleData = m->GetObjectHandle();
|
||||
@@ -424,21 +408,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.FillConsoleOutput;
|
||||
|
||||
switch (a->ElementType)
|
||||
{
|
||||
case CONSOLE_ATTRIBUTE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::FillConsoleOutputAttribute);
|
||||
break;
|
||||
case CONSOLE_ASCII:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::FillConsoleOutputCharacter, false);
|
||||
break;
|
||||
case CONSOLE_REAL_UNICODE:
|
||||
case CONSOLE_FALSE_UNICODE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::FillConsoleOutputCharacter, true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Capture length of initial fill.
|
||||
size_t fill = a->Length;
|
||||
|
||||
@@ -498,7 +467,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleActiveScreenBuffer(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleActiveScreenBuffer);
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
RETURN_HR_IF_NULL(E_HANDLE, pObjectHandle);
|
||||
|
||||
@@ -512,7 +480,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerFlushConsoleInputBuffer(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::FlushConsoleInputBuffer);
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
RETURN_HR_IF_NULL(E_HANDLE, pObjectHandle);
|
||||
|
||||
@@ -530,12 +497,10 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
|
||||
if (a->Output)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleOutputCP);
|
||||
return m->_pApiRoutines->SetConsoleOutputCodePageImpl(a->CodePage);
|
||||
}
|
||||
else
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleCP);
|
||||
return m->_pApiRoutines->SetConsoleInputCodePageImpl(a->CodePage);
|
||||
}
|
||||
}
|
||||
@@ -543,7 +508,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleCursorInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleCursorInfo);
|
||||
const auto a = &m->u.consoleMsgL2.GetConsoleCursorInfo;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -561,7 +525,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleCursorInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleCursorInfo);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleCursorInfo;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -576,7 +539,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleScreenBufferInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleScreenBufferInfoEx);
|
||||
const auto a = &m->u.consoleMsgL2.GetConsoleScreenBufferInfo;
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFOEX ex = { 0 };
|
||||
@@ -609,7 +571,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleScreenBufferInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleScreenBufferInfoEx);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleScreenBufferInfo;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -646,7 +607,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleScreenBufferSize(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleScreenBufferSize);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleScreenBufferSize;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -665,7 +625,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleCursorPosition(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleCursorPosition);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleCursorPosition;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -680,7 +639,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetLargestConsoleWindowSize(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetLargestConsoleWindowSize);
|
||||
const auto a = &m->u.consoleMsgL2.GetLargestConsoleWindowSize;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -698,7 +656,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.ScrollConsoleScreenBuffer;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ScrollConsoleScreenBuffer, a->Unicode);
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
RETURN_HR_IF_NULL(E_HANDLE, pObjectHandle);
|
||||
@@ -732,7 +689,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleTextAttribute(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleTextAttribute);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleTextAttribute;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -751,7 +707,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleWindowInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleWindowInfo);
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleWindowInfo;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -777,21 +732,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
RETURN_HR_IF(E_ACCESSDENIED, !m->GetProcessHandle()->GetPolicy().CanReadOutputBuffer());
|
||||
|
||||
const auto a = &m->u.consoleMsgL2.ReadConsoleOutputString;
|
||||
|
||||
switch (a->StringType)
|
||||
{
|
||||
case CONSOLE_ATTRIBUTE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsoleOutputAttribute);
|
||||
break;
|
||||
case CONSOLE_ASCII:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsoleOutputCharacter, false);
|
||||
break;
|
||||
case CONSOLE_REAL_UNICODE:
|
||||
case CONSOLE_FALSE_UNICODE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsoleOutputCharacter, true);
|
||||
break;
|
||||
}
|
||||
|
||||
a->NumRecords = 0; // Set to 0 records returned in case we have failures.
|
||||
|
||||
PVOID pvBuffer;
|
||||
@@ -843,8 +783,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.WriteConsoleInput;
|
||||
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsoleInput, a->Unicode);
|
||||
|
||||
a->NumRecords = 0;
|
||||
|
||||
RETURN_HR_IF(E_ACCESSDENIED, !m->GetProcessHandle()->GetPolicy().CanWriteInputBuffer());
|
||||
@@ -880,8 +818,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.WriteConsoleOutput;
|
||||
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsoleOutput, a->Unicode);
|
||||
|
||||
// Backup originalRegion and set the written area to a 0 size rectangle in case of failures.
|
||||
const auto originalRegion = Microsoft::Console::Types::Viewport::FromInclusive(til::wrap_small_rect(a->CharRegion));
|
||||
auto writtenRegion = Microsoft::Console::Types::Viewport::FromDimensions(originalRegion.Origin(), { 0, 0 });
|
||||
@@ -923,21 +859,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.WriteConsoleOutputString;
|
||||
|
||||
switch (a->StringType)
|
||||
{
|
||||
case CONSOLE_ATTRIBUTE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsoleOutputAttribute);
|
||||
break;
|
||||
case CONSOLE_ASCII:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsoleOutputCharacter, false);
|
||||
break;
|
||||
case CONSOLE_REAL_UNICODE:
|
||||
case CONSOLE_FALSE_UNICODE:
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::WriteConsoleOutputCharacter, true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set written records to 0 in case we early return.
|
||||
a->NumRecords = 0;
|
||||
|
||||
@@ -1022,8 +943,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
|
||||
const auto a = &m->u.consoleMsgL2.ReadConsoleOutput;
|
||||
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::ReadConsoleOutput, a->Unicode);
|
||||
|
||||
// Backup data region passed and set it to a zero size region in case we exit early for failures.
|
||||
const auto originalRegion = Microsoft::Console::Types::Viewport::FromInclusive(til::wrap_small_rect(a->CharRegion));
|
||||
const auto zeroRegion = Microsoft::Console::Types::Viewport::FromDimensions(originalRegion.Origin(), { 0, 0 });
|
||||
@@ -1076,7 +995,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.GetConsoleTitle;
|
||||
Telemetry::Instance().LogApiCall(a->Original ? Telemetry::ApiCall::GetConsoleOriginalTitle : Telemetry::ApiCall::GetConsoleTitle, a->Unicode);
|
||||
|
||||
PVOID pvBuffer;
|
||||
ULONG cbBuffer;
|
||||
@@ -1133,7 +1051,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL2.SetConsoleTitle;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleTitle, a->Unicode);
|
||||
|
||||
PVOID pvBuffer;
|
||||
ULONG cbOriginalLength;
|
||||
@@ -1155,7 +1072,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleMouseInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetNumberOfConsoleMouseButtons);
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleMouseInfo;
|
||||
|
||||
m->_pApiRoutines->GetNumberOfConsoleMouseButtonsImpl(a->NumButtons);
|
||||
@@ -1165,7 +1081,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleFontSize(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleFontSize);
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleFontSize;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -1182,7 +1097,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleCurrentFont(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetCurrentConsoleFontEx);
|
||||
const auto a = &m->u.consoleMsgL3.GetCurrentConsoleFont;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -1208,7 +1122,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleDisplayMode(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleDisplayMode);
|
||||
const auto a = &m->u.consoleMsgL3.SetConsoleDisplayMode;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
@@ -1225,7 +1138,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleDisplayMode(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleDisplayMode);
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleDisplayMode;
|
||||
|
||||
// Historically this has never checked the handles. It just returns global state.
|
||||
@@ -1238,7 +1150,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.AddConsoleAliasW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::AddConsoleAlias, a->Unicode);
|
||||
|
||||
// Read the input buffer and validate the strings.
|
||||
PVOID pvBuffer;
|
||||
@@ -1286,7 +1197,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleAliasW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleAlias, a->Unicode);
|
||||
|
||||
PVOID pvInputBuffer;
|
||||
ULONG cbInputBufferSize;
|
||||
@@ -1360,7 +1270,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleAliasesLengthW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleAliasesLength, a->Unicode);
|
||||
|
||||
ULONG cbExeNameLength;
|
||||
PVOID pvExeName;
|
||||
@@ -1393,7 +1302,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleAliasExesLengthW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleAliasExesLength, a->Unicode);
|
||||
|
||||
size_t cbAliasExesLength;
|
||||
if (a->Unicode)
|
||||
@@ -1418,7 +1326,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleAliasesW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleAliases, a->Unicode);
|
||||
|
||||
PVOID pvExeName;
|
||||
ULONG cbExeNameLength;
|
||||
@@ -1462,7 +1369,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleAliasExesW;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleAliasExes, a->Unicode);
|
||||
|
||||
PVOID pvBuffer;
|
||||
ULONG cbAliasExesBufferLength;
|
||||
@@ -1621,7 +1527,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleWindow(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleWindow);
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleWindow;
|
||||
|
||||
m->_pApiRoutines->GetConsoleWindowImpl(a->hwnd);
|
||||
@@ -1631,7 +1536,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerGetConsoleSelectionInfo(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleSelectionInfo);
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleSelectionInfo;
|
||||
|
||||
m->_pApiRoutines->GetConsoleSelectionInfoImpl(a->SelectionInfo);
|
||||
@@ -1642,7 +1546,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleHistory;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleHistoryInfo);
|
||||
|
||||
CONSOLE_HISTORY_INFO info;
|
||||
info.cbSize = sizeof(info);
|
||||
@@ -1660,7 +1563,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL3.SetConsoleHistory;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetConsoleHistoryInfo);
|
||||
|
||||
CONSOLE_HISTORY_INFO info;
|
||||
info.cbSize = sizeof(info);
|
||||
@@ -1674,7 +1576,6 @@ static DWORD TraceGetThreadId(CONSOLE_API_MSG* const m)
|
||||
[[nodiscard]] HRESULT ApiDispatchers::ServerSetConsoleCurrentFont(_Inout_ CONSOLE_API_MSG* const m,
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::SetCurrentConsoleFontEx);
|
||||
const auto a = &m->u.consoleMsgL3.SetCurrentConsoleFont;
|
||||
|
||||
const auto pObjectHandle = m->GetObjectHandle();
|
||||
|
||||
@@ -27,7 +27,6 @@ using Microsoft::Console::Interactivity::ServiceLocator;
|
||||
{
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
const auto a = &m->u.consoleMsgL3.GetConsoleProcessList;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleProcessList);
|
||||
|
||||
PVOID Buffer;
|
||||
ULONG BufferSize;
|
||||
@@ -60,7 +59,6 @@ using Microsoft::Console::Interactivity::ServiceLocator;
|
||||
_Inout_ BOOL* const /*pbReplyPending*/)
|
||||
{
|
||||
const auto a = &m->u.consoleMsgL1.GetConsoleLangId;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GetConsoleLangId);
|
||||
|
||||
// TODO: MSFT: 9115192 - This should probably just ask through GetOutputCP and convert it ourselves on this side.
|
||||
return m->_pApiRoutines->GetConsoleLangIdImpl(a->LangId);
|
||||
@@ -71,7 +69,6 @@ using Microsoft::Console::Interactivity::ServiceLocator;
|
||||
{
|
||||
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
const auto a = &m->u.consoleMsgL2.GenerateConsoleCtrlEvent;
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::GenerateConsoleCtrlEvent);
|
||||
|
||||
LockConsole();
|
||||
auto Unlock = wil::scope_exit([&] { UnlockConsole(); });
|
||||
|
||||
@@ -413,7 +413,6 @@ PCONSOLE_API_MSG IoDispatchers::ConsoleHandleConnectionRequest(_In_ PCONSOLE_API
|
||||
{
|
||||
auto& Globals = ServiceLocator::LocateGlobals();
|
||||
auto& gci = Globals.getConsoleInformation();
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::AttachConsole);
|
||||
|
||||
ConsoleProcessHandle* ProcessData = nullptr;
|
||||
NTSTATUS Status;
|
||||
@@ -562,8 +561,6 @@ PCONSOLE_API_MSG IoDispatchers::ConsoleHandleConnectionRequest(_In_ PCONSOLE_API
|
||||
// - A pointer to the reply message.
|
||||
PCONSOLE_API_MSG IoDispatchers::ConsoleClientDisconnectRoutine(_In_ PCONSOLE_API_MSG pMessage)
|
||||
{
|
||||
Telemetry::Instance().LogApiCall(Telemetry::ApiCall::FreeConsole);
|
||||
|
||||
const auto pProcessData = pMessage->GetProcessHandle();
|
||||
|
||||
auto pNotifier = ServiceLocator::LocateAccessibilityNotifier();
|
||||
|
||||
@@ -30,10 +30,6 @@ ConsoleProcessHandle::ConsoleProcessHandle(const DWORD dwProcessId,
|
||||
_shimPolicy(_hProcess.get()),
|
||||
_processCreationTime{}
|
||||
{
|
||||
if (nullptr != _hProcess.get())
|
||||
{
|
||||
Telemetry::Instance().LogProcessConnected(_hProcess.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
||||
Reference in New Issue
Block a user