ImageResizer, PowerRename, FileLocksmith prev handlers

This commit is contained in:
Stefan Markovic
2024-10-14 15:17:32 +02:00
parent 9f00966e67
commit d8ad216319
9 changed files with 32 additions and 2 deletions

View File

@@ -240,12 +240,15 @@ HRESULT ExplorerCommand::s_CreateInstance(IUnknown* pUnkOuter, REFIID riid, void
ExplorerCommand::ExplorerCommand() ExplorerCommand::ExplorerCommand()
{ {
m_etwTrace.UpdateState(true);
++globals::ref_count; ++globals::ref_count;
context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_FILELOCKSMITH_CONTEXT_MENU_ENTRY, L"Unlock with File Locksmith"); context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_FILELOCKSMITH_CONTEXT_MENU_ENTRY, L"Unlock with File Locksmith");
} }
ExplorerCommand::~ExplorerCommand() ExplorerCommand::~ExplorerCommand()
{ {
m_etwTrace.Flush();
m_etwTrace.UpdateState(false);
--globals::ref_count; --globals::ref_count;
} }

View File

@@ -4,6 +4,8 @@
#include "FileLocksmithLib/IPC.h" #include "FileLocksmithLib/IPC.h"
#include <common/Telemetry/EtwTrace/EtwTrace.h>
#define EXPLORER_COMMAND_UUID_STR "84d68575-e186-46ad-b0cb-baeb45ee29c0" #define EXPLORER_COMMAND_UUID_STR "84d68575-e186-46ad-b0cb-baeb45ee29c0"
class __declspec(uuid(EXPLORER_COMMAND_UUID_STR)) ExplorerCommand : public IExplorerCommand, public IShellExtInit, public IContextMenu class __declspec(uuid(EXPLORER_COMMAND_UUID_STR)) ExplorerCommand : public IExplorerCommand, public IShellExtInit, public IContextMenu
@@ -50,4 +52,6 @@ private:
std::atomic<ULONG> m_ref_count = 1; std::atomic<ULONG> m_ref_count = 1;
IDataObject* m_data_obj = NULL; IDataObject* m_data_obj = NULL;
std::wstring context_menu_caption; std::wstring context_menu_caption;
Shared::Trace::ETWTrace m_etwTrace{};
}; };

View File

@@ -103,6 +103,9 @@
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj"> <ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project> <Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj"> <ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project> <Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference> </ProjectReference>

View File

@@ -16,6 +16,7 @@ extern HINSTANCE g_hInst_imageResizer;
CContextMenuHandler::CContextMenuHandler() CContextMenuHandler::CContextMenuHandler()
{ {
m_etwTrace.UpdateState(true);
m_pidlFolder = NULL; m_pidlFolder = NULL;
m_pdtobj = NULL; m_pdtobj = NULL;
context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_IMAGERESIZER_CONTEXT_MENU_ENTRY, L"Resize with Image Resizer"); 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() CContextMenuHandler::~CContextMenuHandler()
{ {
m_etwTrace.Flush();
m_etwTrace.UpdateState(false);
Uninitialize(); Uninitialize();
} }

View File

@@ -5,6 +5,7 @@
#include "pch.h" #include "pch.h"
#include "Generated Files/resource.h" #include "Generated Files/resource.h"
#include "ImageResizerExt_i.h" #include "ImageResizerExt_i.h"
#include <common/Telemetry/EtwTrace/EtwTrace.h>
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #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." #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; HBITMAP m_hbmpIcon = nullptr;
std::wstring context_menu_caption; std::wstring context_menu_caption;
std::wstring context_menu_caption_here; std::wstring context_menu_caption_here;
Shared::Trace::ETWTrace m_etwTrace{};
}; };
OBJECT_ENTRY_AUTO(__uuidof(ContextMenuHandler), CContextMenuHandler) OBJECT_ENTRY_AUTO(__uuidof(ContextMenuHandler), CContextMenuHandler)

View File

@@ -80,12 +80,14 @@
<ClCompile Include="ContextMenuHandler.cpp" /> <ClCompile Include="ContextMenuHandler.cpp" />
<ClCompile Include="dllmain.cpp"> <ClCompile Include="dllmain.cpp">
<CompileAsManaged>false</CompileAsManaged> <CompileAsManaged>false</CompileAsManaged>
<PrecompiledHeader></PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="ImageResizerExt.cpp" /> <ClCompile Include="ImageResizerExt.cpp" />
<ClCompile Include="ImageResizerExt_i.c"> <ClCompile Include="ImageResizerExt_i.c">
<CompileAsManaged>false</CompileAsManaged> <CompileAsManaged>false</CompileAsManaged>
<PrecompiledHeader></PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="pch.cpp"> <ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Create</PrecompiledHeader>
@@ -120,6 +122,9 @@
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj"> <ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project> <Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj"> <ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project> <Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference> </ProjectReference>

View File

@@ -21,12 +21,15 @@ struct InvokeStruct
CPowerRenameMenu::CPowerRenameMenu() CPowerRenameMenu::CPowerRenameMenu()
{ {
m_etwTrace.UpdateState(true);
ModuleAddRef(); ModuleAddRef();
context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_POWERRENAME_CONTEXT_MENU_ENTRY, L"Rename with PowerRename"); context_menu_caption = GET_RESOURCE_STRING_FALLBACK(IDS_POWERRENAME_CONTEXT_MENU_ENTRY, L"Rename with PowerRename");
} }
CPowerRenameMenu::~CPowerRenameMenu() CPowerRenameMenu::~CPowerRenameMenu()
{ {
m_etwTrace.Flush();
m_etwTrace.UpdateState(false);
m_spdo = nullptr; m_spdo = nullptr;
DeleteObject(m_hbmpIcon); DeleteObject(m_hbmpIcon);
ModuleRelease(); ModuleRelease();

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include "pch.h" #include "pch.h"
#include <common/Telemetry/EtwTrace/EtwTrace.h>
class __declspec(uuid("0440049F-D1DC-4E46-B27B-98393D79486B")) CPowerRenameMenu : class __declspec(uuid("0440049F-D1DC-4E46-B27B-98393D79486B")) CPowerRenameMenu :
public IShellExtInit, public IShellExtInit,
public IContextMenu, public IContextMenu,
@@ -70,4 +72,6 @@ private:
HBITMAP m_hbmpIcon = nullptr; HBITMAP m_hbmpIcon = nullptr;
CComPtr<IDataObject> m_spdo; CComPtr<IDataObject> m_spdo;
std::wstring context_menu_caption; std::wstring context_menu_caption;
Shared::Trace::ETWTrace m_etwTrace{};
}; };

View File

@@ -60,6 +60,9 @@
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj"> <ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project> <Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj"> <ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project> <Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference> </ProjectReference>