diff --git a/src/common/Telemetry/TelemetryBase.cs b/src/common/Telemetry/TelemetryBase.cs index b2ec7fd3f88..303b90a886f 100644 --- a/src/common/Telemetry/TelemetryBase.cs +++ b/src/common/Telemetry/TelemetryBase.cs @@ -4,7 +4,6 @@ using System.Diagnostics.Tracing; -// WARNING: THIS FILE GETS REPLACED ON THE BUILD FARM namespace Microsoft.PowerToys.Telemetry { /// @@ -17,10 +16,10 @@ public enum PartA_PrivTags None = 0, /// - ProductAndServicePerformance = 1, + ProductAndServicePerformance = 0x0000000001000000u, /// - ProductAndServiceUsage = 2, + ProductAndServiceUsage = 0x0000000002000000u, } /// @@ -36,17 +35,17 @@ public class TelemetryBase : EventSource /// /// The event tag for this event source. /// - public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0u | DropPii; + public const EventTags ProjectTelemetryTagProductAndServicePerformance = (EventTags)0x0000000001000000u | DropPii; /// /// The event keyword for this event source. /// - public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0; + public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0000400000000000; /// /// Group ID for Powertoys project. /// - private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" }; + private static readonly string[] PowerToysTelemetryTraits = { "MSPG_GROUP", "{5ecb0bac-b930-47f5-a8a4-e8253529edb7}" }; /// /// Initializes a new instance of the class. diff --git a/src/common/Telemetry/TraceLoggingDefines.h b/src/common/Telemetry/TraceLoggingDefines.h index a7c2a0ef7b7..0d8ed1e0cbe 100644 --- a/src/common/Telemetry/TraceLoggingDefines.h +++ b/src/common/Telemetry/TraceLoggingDefines.h @@ -1,7 +1,8 @@ #pragma once -#define TraceLoggingOptionProjectTelemetry() TraceLoggingOptionGroup(0x42749043, 0x438c, 0x46a2, 0x82, 0xbe, 0xc6, 0xcb, 0xeb, 0x19, 0x2f, 0xf2) -#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "Ignore") -#define ProjectTelemetryTag_ProductAndServicePerformance 0x0u -#define PROJECT_KEYWORD_MEASURE 0x0 -#define MICROSOFT_EVENTTAG_DROP_PII 0x02000000 \ No newline at end of file +// Microsoft Partner Group Provider (MSPG) +#define TraceLoggingOptionProjectTelemetry() TraceLoggingOptionGroup(0x5ECB0BAC, 0xB930, 0x47F5, 0xA8, 0xA4, 0xE8, 0x25, 0x35, 0x29, 0xED, 0xB7) +#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "PartA_PrivTags") +#define ProjectTelemetryTag_ProductAndServicePerformance 0x0000000001000000u +#define PROJECT_KEYWORD_MEASURE 0x0000400000000000 +#define MICROSOFT_EVENTTAG_DROP_PII 0x02000000 diff --git a/src/modules/CropAndLock/CropAndLock/main.cpp b/src/modules/CropAndLock/CropAndLock/main.cpp index 3fd18cdaa8c..5e29bbf0f90 100644 --- a/src/modules/CropAndLock/CropAndLock/main.cpp +++ b/src/modules/CropAndLock/CropAndLock/main.cpp @@ -15,8 +15,6 @@ #include #include -#include - #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") namespace winrt @@ -199,9 +197,6 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I } m_event_triggers_thread = std::thread([&]() { - Shared::Trace::ETWTrace trace; - trace.UpdateState(true); - MSG msg; HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle}; while (m_running) @@ -255,8 +250,6 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I break; } } - trace.Flush(); - trace.UpdateState(false); }); // Message pump diff --git a/src/modules/alwaysontop/AlwaysOnTop/main.cpp b/src/modules/alwaysontop/AlwaysOnTop/main.cpp index 13e84a9711f..240e995264f 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/main.cpp +++ b/src/modules/alwaysontop/AlwaysOnTop/main.cpp @@ -6,8 +6,6 @@ #include #include -#include - #include #include @@ -18,9 +16,6 @@ const std::wstring instanceMutexName = L"Local\\PowerToys_AlwaysOnTop_InstanceMu int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PWSTR lpCmdLine, _In_ int nCmdShow) { - Shared::Trace::ETWTrace trace; - trace.UpdateState(true); - winrt::init_apartment(); LoggerHelpers::init_logger(moduleName, internalPath, LogSettings::alwaysOnTopLoggerName); @@ -70,8 +65,5 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, Trace::AlwaysOnTop::UnregisterProvider(); - trace.Flush(); - trace.UpdateState(false); - return 0; } diff --git a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/dllmain.cpp b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/dllmain.cpp index ec540fd6d6a..654f7eb2dbe 100644 --- a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/dllmain.cpp +++ b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/dllmain.cpp @@ -221,7 +221,7 @@ class AlwaysOnTopModuleInterface : public PowertoyModuleIface Trace::AlwaysOnTop::Enable(false); } - // Wait for 1.5 seconds for the process to end process correctly and stop etw tracer + // Wait for 1.5 seconds for the process to end correctly and stop etw tracer WaitForSingleObject(m_hProcess, 1500); // If process is still running, terminate it diff --git a/src/modules/fancyzones/FancyZones/main.cpp b/src/modules/fancyzones/FancyZones/main.cpp index 0510aedb55c..4984ed7af3d 100644 --- a/src/modules/fancyzones/FancyZones/main.cpp +++ b/src/modules/fancyzones/FancyZones/main.cpp @@ -27,9 +27,6 @@ const std::wstring instanceMutexName = L"Local\\PowerToys_FancyZones_InstanceMut int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PWSTR lpCmdLine, _In_ int nCmdShow) { - Shared::Trace::ETWTrace trace{ L"{38e8889b-9731-53f5-e901-e8a7c1753074}" }; - trace.UpdateState(true); - winrt::init_apartment(); LoggerHelpers::init_logger(moduleName, internalPath, LogSettings::fancyZonesLoggerName); @@ -87,9 +84,5 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, run_message_loop(); Trace::UnregisterProvider(); - - trace.UpdateState(false); - trace.Flush(); - return 0; } diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/App.xaml.cpp b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/App.xaml.cpp index 03c17b770fa..415acad0d44 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/App.xaml.cpp +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameXAML/App.xaml.cpp @@ -12,8 +12,6 @@ #include #include -#include - using namespace winrt; using namespace winrt::Microsoft::UI::Xaml; using namespace winrt::Microsoft::UI::Xaml::Controls; @@ -55,9 +53,6 @@ App::App() /// Details about the launch request and process. void App::OnLaunched(LaunchActivatedEventArgs const&) { - Shared::Trace::ETWTrace trace{ L"{38e8889b-9731-53f5-e901-e8a7c1753074}" }; - trace.UpdateState(true); - LoggerHelpers::init_logger(moduleName, L"", LogSettings::powerRenameLoggerName); if (powertoys_gpo::getConfiguredPowerRenameEnabledValue() == powertoys_gpo::gpo_rule_configured_disabled) @@ -195,7 +190,4 @@ void App::OnLaunched(LaunchActivatedEventArgs const&) window = make(); window.Activate(); - - trace.UpdateState(false); - trace.Flush(); } \ No newline at end of file diff --git a/src/runner/main.cpp b/src/runner/main.cpp index 8e6b9414987..a6638580fa7 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -303,9 +302,6 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nCmdShow*/) { - Shared::Trace::ETWTrace trace{ L"{38e8889b-9731-53f5-e901-e8a7c1753074}" }; - trace.UpdateState(true); - Gdiplus::GdiplusStartupInput gpStartupInput; ULONG_PTR gpToken; GdiplusStartup(&gpToken, &gpStartupInput, NULL); @@ -483,9 +479,6 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l result = -1; } - trace.UpdateState(false); - trace.Flush(); - // We need to release the mutexes to be able to restart the application if (msi_mutex) { diff --git a/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs index 0ad4a938ed7..c665e3a21ad 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs @@ -20,12 +20,8 @@ namespace Microsoft.PowerToys.Settings.UI /// /// An empty window that can be used on its own or navigated to within a Frame. /// - public sealed partial class MainWindow : WindowEx, IDisposable + public sealed partial class MainWindow : WindowEx { - private ETWTrace etwTrace = new ETWTrace(); - - private bool _disposed; - public MainWindow(bool createHidden = false) { var bootTime = new System.Diagnostics.Stopwatch(); @@ -214,7 +210,6 @@ private void Window_Closed(object sender, WindowEventArgs args) if (App.GetOobeWindow() == null) { App.ClearSettingsWindow(); - Dispose(); } else { @@ -245,26 +240,5 @@ internal void EnsurePageIsSelected() { ShellPage.EnsurePageIsSelected(); } - - public void Dispose(bool disposing) - { - if (_disposed) - { - return; - } - - if (disposing) - { - etwTrace?.Dispose(); - } - - _disposed = true; - } - - public void Dispose() - { - Dispose(disposing: true); - GC.SuppressFinalize(this); - } } }