mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:05:59 +08:00
[FileLocksmith] Fix issue causing explorer to crash (#27335)
Remove unneeded registry key Align context menu handler logic with other modules
This commit is contained in:
parent
4e9f4e57db
commit
9ad50161dc
@ -26,9 +26,6 @@
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\Drive\ShellEx\ContextMenuHandlers\FileLocksmithExt">
|
||||
<RegistryValue Type="string" Value="{84D68575-E186-46AD-B0CB-BAEB45EE29C0}"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="SOFTWARE\Classes\Directory\background\ShellEx\ContextMenuHandlers\FileLocksmithExt">
|
||||
<RegistryValue Type="string" Value="{84D68575-E186-46AD-B0CB-BAEB45EE29C0}"/>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
@ -69,25 +69,7 @@ IFACEMETHODIMP ExplorerCommand::GetCanonicalName(GUID* pguidCommandName)
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetState(IShellItemArray* psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE* pCmdState)
|
||||
{
|
||||
if (!globals::enabled)
|
||||
{
|
||||
*pCmdState = ECS_HIDDEN;
|
||||
}
|
||||
|
||||
if (FileLocksmithSettingsInstance().GetShowInExtendedContextMenu())
|
||||
{
|
||||
*pCmdState = ECS_HIDDEN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// When right clicking directory background, selection is empty.
|
||||
if (nullptr == psiItemArray)
|
||||
{
|
||||
*pCmdState = ECS_HIDDEN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*pCmdState = ECS_ENABLED;
|
||||
*pCmdState = FileLocksmithSettingsInstance().GetEnabled() ? ECS_ENABLED : ECS_HIDDEN;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -112,9 +94,11 @@ IFACEMETHODIMP ExplorerCommand::EnumSubCommands(IEnumExplorerCommand** ppEnum)
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject* pdtobj, HKEY hkeyProgID)
|
||||
{
|
||||
m_data_obj = NULL;
|
||||
|
||||
if (!FileLocksmithSettingsInstance().GetEnabled())
|
||||
{
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (pdtobj)
|
||||
@ -132,12 +116,12 @@ IFACEMETHODIMP ExplorerCommand::QueryContextMenu(HMENU hmenu, UINT indexMenu, UI
|
||||
// Skip if disabled
|
||||
if (!FileLocksmithSettingsInstance().GetEnabled())
|
||||
{
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FileLocksmithSettingsInstance().GetShowInExtendedContextMenu() && !(uFlags & CMF_EXTENDEDVERBS))
|
||||
{
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT hr = E_UNEXPECTED;
|
||||
|
@ -11,7 +11,6 @@ namespace globals
|
||||
{
|
||||
HMODULE instance;
|
||||
std::atomic<ULONG> ref_count;
|
||||
std::atomic<bool> enabled;
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
|
Loading…
Reference in New Issue
Block a user