diff --git a/src/windows/common/notifications.cpp b/src/windows/common/notifications.cpp index 7fbed1b..5e40904 100644 --- a/src/windows/common/notifications.cpp +++ b/src/windows/common/notifications.cpp @@ -86,8 +86,8 @@ try - - + + )", Localization::MessageNewWslVersionAvailable(Localization::Options::DontImpersonate), @@ -118,8 +118,8 @@ try - - + + )", Localization::MessagePerformanceTip(Localization::Options::DontImpersonate), @@ -151,7 +151,7 @@ try - + )", Localization::MessageWarningDuringStartup(), @@ -176,7 +176,7 @@ try - + )", Localization::MessageMissingOptionalComponents(), diff --git a/src/windows/inc/wslhost.h b/src/windows/inc/wslhost.h index 1e35f9f..739aada 100644 --- a/src/windows/inc/wslhost.h +++ b/src/windows/inc/wslhost.h @@ -33,5 +33,5 @@ LPCWSTR const handle_option = L"--handle"; LPCWSTR const event_option = L"--event"; LPCWSTR const parent_option = L"--parent"; LPCWSTR const vm_id_option = L"--vm-id"; -LPCWSTR const embedding_option = L"--Embedding"; +LPCWSTR const embedding_option = L"-Embedding"; } // namespace wslhost \ No newline at end of file diff --git a/src/windows/service/exe/LxssUserSession.cpp b/src/windows/service/exe/LxssUserSession.cpp index 1471b6b..9f3a355 100644 --- a/src/windows/service/exe/LxssUserSession.cpp +++ b/src/windows/service/exe/LxssUserSession.cpp @@ -2172,13 +2172,22 @@ HRESULT LxssUserSessionImpl::Shutdown(_In_ bool PreventNewInstances, ShutdownBeh return S_OK; } -void LxssUserSessionImpl::TelemetryWorker(_In_ wil::unique_socket&& socket, _In_ bool drvFsNotifications) const +void LxssUserSessionImpl::TelemetryWorker(_In_ wil::unique_socket&& socket) const try { wsl::windows::common::wslutil::SetThreadDescription(L"Telemetry"); 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. for (;;) @@ -2852,17 +2861,9 @@ void LxssUserSessionImpl::_CreateVm() // If the telemetry is enabled, launch the telemetry agent inside the VM. if (m_utilityVm->GetConfig().EnableTelemetry && TraceLoggingProviderEnabled(g_hTraceLoggingProvider, WINEVENT_LEVEL_INFO, 0)) { - bool drvFsNotifications = false; - { - 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; - } - LPCSTR Arguments[] = {LX_INIT_TELEMETRY_AGENT, nullptr}; auto socket = m_utilityVm->CreateRootNamespaceProcess(LX_INIT_PATH, Arguments); - m_telemetryThread = std::thread(&LxssUserSessionImpl::TelemetryWorker, this, std::move(socket), drvFsNotifications); + m_telemetryThread = std::thread(&LxssUserSessionImpl::TelemetryWorker, this, std::move(socket)); } m_pluginManager.OnVmStarted(&m_session, &userSettings); diff --git a/src/windows/service/exe/LxssUserSession.h b/src/windows/service/exe/LxssUserSession.h index 75ecc0a..6e2d416 100644 --- a/src/windows/service/exe/LxssUserSession.h +++ b/src/windows/service/exe/LxssUserSession.h @@ -503,7 +503,7 @@ public: /// /// Worker thread for logging telemetry about processes running inside of WSL. /// - void TelemetryWorker(_In_ wil::unique_socket&& socket, _In_ bool drvFsNotifications) const; + void TelemetryWorker(_In_ wil::unique_socket&& socket) const; /// /// Terminates a distribution by it's client identifier. diff --git a/src/windows/wslhost/main.cpp b/src/windows/wslhost/main.cpp index a5ad0bc..e89dbe7 100644 --- a/src/windows/wslhost/main.cpp +++ b/src/windows/wslhost/main.cpp @@ -74,12 +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 so getopt can be used to parse the arguments. - auto commandLine = wil::GetModuleFileNameW(wil::GetModuleInstanceHandle()); - commandLine += L" "; - commandLine += invokedArgs; - - ArgumentParser parser(GetCommandLineW(), wslhost::binary_name); + ArgumentParser parser(invokedArgs, wslhost::binary_name, 0); parser.AddArgument( []() { std::wstring path;