mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +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();
|
||||
|
||||
EtwTrace.Start();
|
||||
|
||||
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
||||
{
|
||||
services.AddSingleton<OptionsViewModel>();
|
||||
|
||||
@@ -80,8 +80,6 @@ namespace EnvironmentVariables
|
||||
/// <param name="args">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
||||
{
|
||||
EtwTrace.Start();
|
||||
|
||||
var cmdArgs = Environment.GetCommandLineArgs();
|
||||
if (cmdArgs?.Length > 1)
|
||||
{
|
||||
|
||||
@@ -107,8 +107,6 @@ namespace Hosts
|
||||
/// <param name="args">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
EtwTrace.Start();
|
||||
|
||||
var cmdArgs = Environment.GetCommandLineArgs();
|
||||
if (cmdArgs?.Length > 1)
|
||||
{
|
||||
|
||||
@@ -57,8 +57,6 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
ETWTrace etwTrace = new ETWTrace();
|
||||
|
||||
etwTrace.Start();
|
||||
|
||||
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.");
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace MouseWithoutBorders
|
||||
}
|
||||
|
||||
ETWTrace etwTrace = new ETWTrace();
|
||||
etwTrace.Start();
|
||||
|
||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||
{
|
||||
|
||||
@@ -47,8 +47,6 @@ public partial class App : Application, IDisposable
|
||||
|
||||
NativeThreadCTS = new CancellationTokenSource();
|
||||
|
||||
etwTrace.Start();
|
||||
|
||||
NativeEventWaiter.WaitForEventLoop(
|
||||
Constants.TerminatePowerOCRSharedEvent(),
|
||||
this.Shutdown,
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace WorkspacesEditor
|
||||
|
||||
public App()
|
||||
{
|
||||
etwTrace.Start();
|
||||
WorkspacesEditorIO = new WorkspacesEditorIO();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace Awake
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
_etwTrace.Start();
|
||||
_settingsUtils = new SettingsUtils();
|
||||
LockMutex = new Mutex(true, Core.Constants.AppName, out bool instantiated);
|
||||
Logger.InitializeLogger(Path.Combine("\\", Core.Constants.AppName, "Logs"));
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace ColorPickerUI
|
||||
Logger.LogError("CultureNotFoundException: " + ex.Message);
|
||||
}
|
||||
|
||||
EtwTrace.Start();
|
||||
NativeThreadCTS = new CancellationTokenSource();
|
||||
ExitToken = NativeThreadCTS.Token;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <common/utils/logger_helper.h>
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/UnhandledExceptionHandler.h>
|
||||
#include <common/interop/shared_constants.h>
|
||||
|
||||
#include <FancyZonesLib/Generated Files/resource.h>
|
||||
#include <FancyZonesLib/FancyZonesData.h>
|
||||
@@ -20,6 +21,14 @@ FancyZonesApp::FancyZonesApp(const std::wstring& appName, const std::wstring& ap
|
||||
InitializeWinhookEventIds();
|
||||
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();
|
||||
|
||||
s_instance = this;
|
||||
@@ -111,7 +120,7 @@ void FancyZonesApp::InitHooks()
|
||||
|
||||
void FancyZonesApp::DisableModule() noexcept
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
PostThreadMessage(m_mainThreadId, WM_QUIT, 0, 0);
|
||||
}
|
||||
|
||||
void FancyZonesApp::HandleWinHookEvent(WinHookEvent* data) noexcept
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/hooks/LowlevelKeyboardEvent.h>
|
||||
#include <common/utils/EventWaiter.h>
|
||||
|
||||
#include <FancyZonesLib/FancyZones.h>
|
||||
|
||||
@@ -15,11 +16,14 @@ public:
|
||||
private:
|
||||
static inline FancyZonesApp* s_instance = nullptr;
|
||||
static inline HHOOK s_llKeyboardHook = nullptr;
|
||||
|
||||
|
||||
winrt::com_ptr<IFancyZones> m_app;
|
||||
HWINEVENTHOOK m_objectLocationWinEventHook = nullptr;
|
||||
std::vector<HWINEVENTHOOK> m_staticWinEventHooks;
|
||||
|
||||
EventWaiter m_exitEventWaiter;
|
||||
DWORD m_mainThreadId;
|
||||
|
||||
void DisableModule() noexcept;
|
||||
|
||||
void InitHooks();
|
||||
|
||||
@@ -96,7 +96,6 @@ namespace PowerLauncher
|
||||
using (var application = new App())
|
||||
{
|
||||
application.InitializeComponent();
|
||||
application.etwTrace.Start();
|
||||
|
||||
Common.UI.NativeEventWaiter.WaitForEventLoop(
|
||||
Constants.RunExitEvent(),
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace Peek.UI
|
||||
InitializeComponent();
|
||||
Logger.InitializeLogger("\\Peek\\Logs");
|
||||
|
||||
EtwTrace.Start();
|
||||
|
||||
Host = Microsoft.Extensions.Hosting.Host.
|
||||
CreateDefaultBuilder().
|
||||
UseContentRoot(AppContext.BaseDirectory).
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace PowerAccent.UI
|
||||
}
|
||||
|
||||
base.OnStartup(e);
|
||||
_etwTrace.Start();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace RegistryPreview
|
||||
// #if DEBUG
|
||||
// System.Diagnostics.Debugger.Launch();
|
||||
// #endif
|
||||
EtwTrace.Start();
|
||||
|
||||
// Open With... handler - gets activation arguments if they are available.
|
||||
AppActivationArguments activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
|
||||
|
||||
@@ -81,7 +81,6 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
Logger.InitializeLogger(@"\Settings\Logs");
|
||||
|
||||
EtwTrace = new ETWTrace();
|
||||
EtwTrace.Start();
|
||||
|
||||
string appLanguage = LanguageHelper.LoadLanguage();
|
||||
if (!string.IsNullOrEmpty(appLanguage))
|
||||
|
||||
Reference in New Issue
Block a user