pr feedback

This commit is contained in:
Ben Hillis 2025-12-15 18:44:29 -08:00
parent f3821479ad
commit 881edcf6b4
2 changed files with 12 additions and 18 deletions

View File

@ -2179,9 +2179,17 @@ try
wsl::shared::SocketChannel channel(std::move(socket), "Telemetry", m_vmTerminating.get());
// Check if drvfs notifications are enabled for the user.
bool drvFsNotifications{};
{
auto impersonate = wil::impersonate_token(m_userToken.get());
const auto lxssKey = wsl::windows::common::registry::OpenLxssUserKey();
drvFsNotifications =
wsl::windows::common::registry::ReadDword(lxssKey.get(), LXSS_NOTIFICATIONS_KEY, LXSS_NOTIFICATION_DRVFS_PERF_DISABLED, 0) == 0;
}
// Aggregate information about what is running inside the VM. This is logged
// periodically because logging each event individually would be too noisy.
bool drvFsNotifications = true;
for (;;)
{
auto [Message, Span] = channel.ReceiveMessageOrClosed<LX_MINI_INIT_TELEMETRY_MESSAGE>();
@ -2222,20 +2230,9 @@ try
if (drvFsNotifications && Message->ShowDrvFsNotification && !values.empty())
{
// Check if drvfs notifications are enabled for the user.
{
auto impersonate = wil::impersonate_token(m_userToken.get());
const auto lxssKey = wsl::windows::common::registry::OpenLxssUserKey();
drvFsNotifications = wsl::windows::common::registry::ReadDword(
lxssKey.get(), LXSS_NOTIFICATIONS_KEY, LXSS_NOTIFICATION_DRVFS_PERF_DISABLED, 0) == 0;
}
// If a drvfs notification is requested, the first entry is the executable that triggered it.
if (drvFsNotifications)
{
LOG_IF_FAILED(wsl::windows::common::notifications::DisplayFilesystemNotification(values[0].c_str()));
drvFsNotifications = false;
}
LOG_IF_FAILED(wsl::windows::common::notifications::DisplayFilesystemNotification(values[0].c_str()));
drvFsNotifications = false;
}
}
}

View File

@ -74,10 +74,7 @@ public:
// Log telemetry when a WSL notification is activated, used to determine user engagement for notifications
WSL_LOG_TELEMETRY("NotificationActivate", PDT_ProductAndServicePerformance, TraceLoggingValue(invokedArgs, "Arguments"));
// Prepend the executable name to the arguments.
auto commandLine = std::format(L"\"{}\" {}", wil::GetModuleFileNameW<std::wstring>(wil::GetModuleInstanceHandle()), invokedArgs);
ArgumentParser parser(commandLine.c_str(), wslhost::binary_name);
ArgumentParser parser(invokedArgs, wslhost::binary_name, 0);
parser.AddArgument(
[]() {
std::wstring path;