From d8ad21631930b462769801452477763cfb25072c Mon Sep 17 00:00:00 2001 From: Stefan Markovic Date: Mon, 14 Oct 2024 15:17:32 +0200 Subject: [PATCH] ImageResizer, PowerRename, FileLocksmith prev handlers --- .../FileLocksmith/FileLocksmithExt/ExplorerCommand.cpp | 3 +++ .../FileLocksmith/FileLocksmithExt/ExplorerCommand.h | 4 ++++ .../FileLocksmithExt/FileLocksmithExt.vcxproj | 3 +++ src/modules/imageresizer/dll/ContextMenuHandler.cpp | 3 +++ src/modules/imageresizer/dll/ContextMenuHandler.h | 2 ++ src/modules/imageresizer/dll/ImageResizerExt.vcxproj | 9 +++++++-- src/modules/powerrename/dll/PowerRenameExt.cpp | 3 +++ src/modules/powerrename/dll/PowerRenameExt.h | 4 ++++ src/modules/powerrename/dll/PowerRenameExt.vcxproj | 3 +++ 9 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.cpp b/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.cpp index bc4ab945ca..6856ae56bf 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.cpp +++ b/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.cpp @@ -240,12 +240,15 @@ HRESULT ExplorerCommand::s_CreateInstance(IUnknown* pUnkOuter, REFIID riid, void ExplorerCommand::ExplorerCommand() { + m_etwTrace.UpdateState(true); ++globals::ref_count; context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_FILELOCKSMITH_CONTEXT_MENU_ENTRY, L"Unlock with File Locksmith"); } ExplorerCommand::~ExplorerCommand() { + m_etwTrace.Flush(); + m_etwTrace.UpdateState(false); --globals::ref_count; } diff --git a/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.h b/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.h index d59f266157..187a1119eb 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.h +++ b/src/modules/FileLocksmith/FileLocksmithExt/ExplorerCommand.h @@ -4,6 +4,8 @@ #include "FileLocksmithLib/IPC.h" +#include + #define EXPLORER_COMMAND_UUID_STR "84d68575-e186-46ad-b0cb-baeb45ee29c0" class __declspec(uuid(EXPLORER_COMMAND_UUID_STR)) ExplorerCommand : public IExplorerCommand, public IShellExtInit, public IContextMenu @@ -50,4 +52,6 @@ private: std::atomic m_ref_count = 1; IDataObject* m_data_obj = NULL; std::wstring context_menu_caption; + + Shared::Trace::ETWTrace m_etwTrace{}; }; diff --git a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj index 9bfad7f8a8..0c285a8bfa 100644 --- a/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj +++ b/src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj @@ -103,6 +103,9 @@ {6955446d-23f7-4023-9bb3-8657f904af99} + + {8f021b46-362b-485c-bfba-ccf83e820cbd} + {98537082-0fdb-40de-abd8-0dc5a4269bab} diff --git a/src/modules/imageresizer/dll/ContextMenuHandler.cpp b/src/modules/imageresizer/dll/ContextMenuHandler.cpp index dd86eed5fb..2798c06d86 100644 --- a/src/modules/imageresizer/dll/ContextMenuHandler.cpp +++ b/src/modules/imageresizer/dll/ContextMenuHandler.cpp @@ -16,6 +16,7 @@ extern HINSTANCE g_hInst_imageResizer; CContextMenuHandler::CContextMenuHandler() { + m_etwTrace.UpdateState(true); m_pidlFolder = NULL; m_pdtobj = NULL; context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_IMAGERESIZER_CONTEXT_MENU_ENTRY, L"Resize with Image Resizer"); @@ -24,6 +25,8 @@ CContextMenuHandler::CContextMenuHandler() CContextMenuHandler::~CContextMenuHandler() { + m_etwTrace.Flush(); + m_etwTrace.UpdateState(false); Uninitialize(); } diff --git a/src/modules/imageresizer/dll/ContextMenuHandler.h b/src/modules/imageresizer/dll/ContextMenuHandler.h index ba1465df88..e906b19eeb 100644 --- a/src/modules/imageresizer/dll/ContextMenuHandler.h +++ b/src/modules/imageresizer/dll/ContextMenuHandler.h @@ -5,6 +5,7 @@ #include "pch.h" #include "Generated Files/resource.h" #include "ImageResizerExt_i.h" +#include #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." @@ -53,6 +54,7 @@ private: HBITMAP m_hbmpIcon = nullptr; std::wstring context_menu_caption; std::wstring context_menu_caption_here; + Shared::Trace::ETWTrace m_etwTrace{}; }; OBJECT_ENTRY_AUTO(__uuidof(ContextMenuHandler), CContextMenuHandler) \ No newline at end of file diff --git a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj index 90bcd8e357..df038e2c43 100644 --- a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj +++ b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj @@ -80,12 +80,14 @@ false - + + false - + + Create @@ -120,6 +122,9 @@ {6955446d-23f7-4023-9bb3-8657f904af99} + + {8f021b46-362b-485c-bfba-ccf83e820cbd} + {98537082-0fdb-40de-abd8-0dc5a4269bab} diff --git a/src/modules/powerrename/dll/PowerRenameExt.cpp b/src/modules/powerrename/dll/PowerRenameExt.cpp index 9e9f2910e7..478f781b6c 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.cpp +++ b/src/modules/powerrename/dll/PowerRenameExt.cpp @@ -21,12 +21,15 @@ struct InvokeStruct CPowerRenameMenu::CPowerRenameMenu() { + m_etwTrace.UpdateState(true); ModuleAddRef(); context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_POWERRENAME_CONTEXT_MENU_ENTRY, L"Rename with PowerRename"); } CPowerRenameMenu::~CPowerRenameMenu() { + m_etwTrace.Flush(); + m_etwTrace.UpdateState(false); m_spdo = nullptr; DeleteObject(m_hbmpIcon); ModuleRelease(); diff --git a/src/modules/powerrename/dll/PowerRenameExt.h b/src/modules/powerrename/dll/PowerRenameExt.h index e2ffcda85c..6dc0dcd69a 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.h +++ b/src/modules/powerrename/dll/PowerRenameExt.h @@ -1,6 +1,8 @@ #pragma once #include "pch.h" +#include + class __declspec(uuid("0440049F-D1DC-4E46-B27B-98393D79486B")) CPowerRenameMenu : public IShellExtInit, public IContextMenu, @@ -70,4 +72,6 @@ private: HBITMAP m_hbmpIcon = nullptr; CComPtr m_spdo; std::wstring context_menu_caption; + + Shared::Trace::ETWTrace m_etwTrace{}; }; diff --git a/src/modules/powerrename/dll/PowerRenameExt.vcxproj b/src/modules/powerrename/dll/PowerRenameExt.vcxproj index a994c25148..ead9518f35 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.vcxproj +++ b/src/modules/powerrename/dll/PowerRenameExt.vcxproj @@ -60,6 +60,9 @@ {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} + + {8f021b46-362b-485c-bfba-ccf83e820cbd} + {98537082-0fdb-40de-abd8-0dc5a4269bab}