diff options
author | Christian Kamm <mail@ckamm.de> | 2019-03-04 11:36:29 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2019-03-04 11:36:29 +0300 |
commit | 221b8680e4a472f6030dc9ab7df099318c42672e (patch) | |
tree | a48c26e3155088d4c897db1d397a95b631960e2c /shell_integration | |
parent | 3d18e520179982abdab3366682c904c2d5814f8f (diff) | |
parent | c859f87997433ebac7da7c9f00dcdc1e9573c5b9 (diff) |
Merge remote-tracking branch 'origin/2.5'
Diffstat (limited to 'shell_integration')
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCContextMenu.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/shell_integration/windows/OCContextMenu/OCContextMenu.cpp b/shell_integration/windows/OCContextMenu/OCContextMenu.cpp index 9356187fe..86d8fea12 100644 --- a/shell_integration/windows/OCContextMenu/OCContextMenu.cpp +++ b/shell_integration/windows/OCContextMenu/OCContextMenu.cpp @@ -182,20 +182,38 @@ IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici) { std::wstring command; + CMINVOKECOMMANDINFOEX *piciEx = nullptr; + if (pici->cbSize == sizeof(CMINVOKECOMMANDINFOEX)) + piciEx = (CMINVOKECOMMANDINFOEX*)pici; + // For the Unicode case, if the high-order word is not zero, the // command's verb string is in lpcmi->lpVerbW. - if (HIWORD(((CMINVOKECOMMANDINFOEX*)pici)->lpVerbW)) - { - command = ((CMINVOKECOMMANDINFOEX *)pici)->lpVerbW; - } else { + if (piciEx + && (piciEx->fMask & CMIC_MASK_UNICODE) + && HIWORD(((CMINVOKECOMMANDINFOEX*)pici)->lpVerbW)) { + + command = piciEx->lpVerbW; + + // Verify that we handle the verb + bool handled = false; + for (auto &item : m_info.menuItems) { + if (item.command == command) { + handled = true; + break; + } + } + if (!handled) + return E_FAIL; + } else if (IS_INTRESOURCE(pici->lpVerb)) { // If the command cannot be identified through the verb string, then // check the identifier offset. - auto offset = LOWORD(pici->lpVerb); if (offset >= m_info.menuItems.size()) return E_FAIL; command = m_info.menuItems[offset].command; + } else { + return E_FAIL; } OCClientInterface::SendRequest(command.data(), m_selectedFiles); |