mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Do not start manually C# EtwTrace. FZ engine exit event.
This commit is contained in:
@@ -61,8 +61,6 @@ namespace AdvancedPaste
|
|||||||
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
||||||
{
|
{
|
||||||
services.AddSingleton<OptionsViewModel>();
|
services.AddSingleton<OptionsViewModel>();
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ namespace EnvironmentVariables
|
|||||||
/// <param name="args">Details about the launch request and process.</param>
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
var cmdArgs = Environment.GetCommandLineArgs();
|
var cmdArgs = Environment.GetCommandLineArgs();
|
||||||
if (cmdArgs?.Length > 1)
|
if (cmdArgs?.Length > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ namespace Hosts
|
|||||||
/// <param name="args">Details about the launch request and process.</param>
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
var cmdArgs = Environment.GetCommandLineArgs();
|
var cmdArgs = Environment.GetCommandLineArgs();
|
||||||
if (cmdArgs?.Length > 1)
|
if (cmdArgs?.Length > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ namespace MouseWithoutBorders.Class
|
|||||||
|
|
||||||
ETWTrace etwTrace = new ETWTrace();
|
ETWTrace etwTrace = new ETWTrace();
|
||||||
|
|
||||||
etwTrace.Start();
|
|
||||||
|
|
||||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredMouseWithoutBordersEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredMouseWithoutBordersEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||||
{
|
{
|
||||||
Common.Log("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
Common.Log("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace MouseWithoutBorders
|
|||||||
}
|
}
|
||||||
|
|
||||||
ETWTrace etwTrace = new ETWTrace();
|
ETWTrace etwTrace = new ETWTrace();
|
||||||
etwTrace.Start();
|
|
||||||
|
|
||||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ public partial class App : Application, IDisposable
|
|||||||
|
|
||||||
NativeThreadCTS = new CancellationTokenSource();
|
NativeThreadCTS = new CancellationTokenSource();
|
||||||
|
|
||||||
etwTrace.Start();
|
|
||||||
|
|
||||||
NativeEventWaiter.WaitForEventLoop(
|
NativeEventWaiter.WaitForEventLoop(
|
||||||
Constants.TerminatePowerOCRSharedEvent(),
|
Constants.TerminatePowerOCRSharedEvent(),
|
||||||
this.Shutdown,
|
this.Shutdown,
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace WorkspacesEditor
|
|||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
etwTrace.Start();
|
|
||||||
WorkspacesEditorIO = new WorkspacesEditorIO();
|
WorkspacesEditorIO = new WorkspacesEditorIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ namespace Awake
|
|||||||
|
|
||||||
private static int Main(string[] args)
|
private static int Main(string[] args)
|
||||||
{
|
{
|
||||||
_etwTrace.Start();
|
|
||||||
_settingsUtils = new SettingsUtils();
|
_settingsUtils = new SettingsUtils();
|
||||||
LockMutex = new Mutex(true, Core.Constants.AppName, out bool instantiated);
|
LockMutex = new Mutex(true, Core.Constants.AppName, out bool instantiated);
|
||||||
Logger.InitializeLogger(Path.Combine("\\", Core.Constants.AppName, "Logs"));
|
Logger.InitializeLogger(Path.Combine("\\", Core.Constants.AppName, "Logs"));
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ namespace ColorPickerUI
|
|||||||
Logger.LogError("CultureNotFoundException: " + ex.Message);
|
Logger.LogError("CultureNotFoundException: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
EtwTrace.Start();
|
|
||||||
NativeThreadCTS = new CancellationTokenSource();
|
NativeThreadCTS = new CancellationTokenSource();
|
||||||
ExitToken = NativeThreadCTS.Token;
|
ExitToken = NativeThreadCTS.Token;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <common/utils/logger_helper.h>
|
#include <common/utils/logger_helper.h>
|
||||||
#include <common/utils/resources.h>
|
#include <common/utils/resources.h>
|
||||||
#include <common/utils/UnhandledExceptionHandler.h>
|
#include <common/utils/UnhandledExceptionHandler.h>
|
||||||
|
#include <common/interop/shared_constants.h>
|
||||||
|
|
||||||
#include <FancyZonesLib/Generated Files/resource.h>
|
#include <FancyZonesLib/Generated Files/resource.h>
|
||||||
#include <FancyZonesLib/FancyZonesData.h>
|
#include <FancyZonesLib/FancyZonesData.h>
|
||||||
@@ -20,6 +21,14 @@ FancyZonesApp::FancyZonesApp(const std::wstring& appName, const std::wstring& ap
|
|||||||
InitializeWinhookEventIds();
|
InitializeWinhookEventIds();
|
||||||
m_app = MakeFancyZones(reinterpret_cast<HINSTANCE>(&__ImageBase), std::bind(&FancyZonesApp::DisableModule, this));
|
m_app = MakeFancyZones(reinterpret_cast<HINSTANCE>(&__ImageBase), std::bind(&FancyZonesApp::DisableModule, this));
|
||||||
|
|
||||||
|
m_mainThreadId = GetCurrentThreadId();
|
||||||
|
m_exitEventWaiter = EventWaiter(CommonSharedConstants::FZE_EXIT_EVENT, [&](int err) {
|
||||||
|
if (err == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
DisableModule();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
InitHooks();
|
InitHooks();
|
||||||
|
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
@@ -111,7 +120,7 @@ void FancyZonesApp::InitHooks()
|
|||||||
|
|
||||||
void FancyZonesApp::DisableModule() noexcept
|
void FancyZonesApp::DisableModule() noexcept
|
||||||
{
|
{
|
||||||
PostQuitMessage(0);
|
PostThreadMessage(m_mainThreadId, WM_QUIT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyZonesApp::HandleWinHookEvent(WinHookEvent* data) noexcept
|
void FancyZonesApp::HandleWinHookEvent(WinHookEvent* data) noexcept
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <common/hooks/LowlevelKeyboardEvent.h>
|
#include <common/hooks/LowlevelKeyboardEvent.h>
|
||||||
|
#include <common/utils/EventWaiter.h>
|
||||||
|
|
||||||
#include <FancyZonesLib/FancyZones.h>
|
#include <FancyZonesLib/FancyZones.h>
|
||||||
|
|
||||||
@@ -20,6 +21,9 @@ private:
|
|||||||
HWINEVENTHOOK m_objectLocationWinEventHook = nullptr;
|
HWINEVENTHOOK m_objectLocationWinEventHook = nullptr;
|
||||||
std::vector<HWINEVENTHOOK> m_staticWinEventHooks;
|
std::vector<HWINEVENTHOOK> m_staticWinEventHooks;
|
||||||
|
|
||||||
|
EventWaiter m_exitEventWaiter;
|
||||||
|
DWORD m_mainThreadId;
|
||||||
|
|
||||||
void DisableModule() noexcept;
|
void DisableModule() noexcept;
|
||||||
|
|
||||||
void InitHooks();
|
void InitHooks();
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ namespace PowerLauncher
|
|||||||
using (var application = new App())
|
using (var application = new App())
|
||||||
{
|
{
|
||||||
application.InitializeComponent();
|
application.InitializeComponent();
|
||||||
application.etwTrace.Start();
|
|
||||||
|
|
||||||
Common.UI.NativeEventWaiter.WaitForEventLoop(
|
Common.UI.NativeEventWaiter.WaitForEventLoop(
|
||||||
Constants.RunExitEvent(),
|
Constants.RunExitEvent(),
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ namespace Peek.UI
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Logger.InitializeLogger("\\Peek\\Logs");
|
Logger.InitializeLogger("\\Peek\\Logs");
|
||||||
|
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
Host = Microsoft.Extensions.Hosting.Host.
|
Host = Microsoft.Extensions.Hosting.Host.
|
||||||
CreateDefaultBuilder().
|
CreateDefaultBuilder().
|
||||||
UseContentRoot(AppContext.BaseDirectory).
|
UseContentRoot(AppContext.BaseDirectory).
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace PowerAccent.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
_etwTrace.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnExit(ExitEventArgs e)
|
protected override void OnExit(ExitEventArgs e)
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ namespace RegistryPreview
|
|||||||
// #if DEBUG
|
// #if DEBUG
|
||||||
// System.Diagnostics.Debugger.Launch();
|
// System.Diagnostics.Debugger.Launch();
|
||||||
// #endif
|
// #endif
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
// Open With... handler - gets activation arguments if they are available.
|
// Open With... handler - gets activation arguments if they are available.
|
||||||
AppActivationArguments activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
|
AppActivationArguments activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
Logger.InitializeLogger(@"\Settings\Logs");
|
Logger.InitializeLogger(@"\Settings\Logs");
|
||||||
|
|
||||||
EtwTrace = new ETWTrace();
|
EtwTrace = new ETWTrace();
|
||||||
EtwTrace.Start();
|
|
||||||
|
|
||||||
string appLanguage = LanguageHelper.LoadLanguage();
|
string appLanguage = LanguageHelper.LoadLanguage();
|
||||||
if (!string.IsNullOrEmpty(appLanguage))
|
if (!string.IsNullOrEmpty(appLanguage))
|
||||||
|
|||||||
Reference in New Issue
Block a user