[ZIPFLDR] Add 'Extract All' menu item to the folder context menu.

This commit is contained in:
Mark Jansen 2018-08-02 21:36:54 +02:00
parent 09719d25c4
commit 875e58d781
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -301,10 +301,15 @@ public:
return hr; return hr;
} }
if (riid == IID_IExplorerCommandProvider) else if (riid == IID_IExplorerCommandProvider)
{ {
return _CExplorerCommandProvider_CreateInstance(this, riid, ppvOut); return _CExplorerCommandProvider_CreateInstance(this, riid, ppvOut);
} }
else if (riid == IID_IContextMenu)
{
// Folder context menu
return QueryInterface(riid, ppvOut);
}
if (UnknownIID != riid) if (UnknownIID != riid)
DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid)); DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid));
return E_NOTIMPL; return E_NOTIMPL;
@ -379,6 +384,7 @@ public:
} }
else if (riid == IID_IContextMenu && cidl >= 0) else if (riid == IID_IContextMenu && cidl >= 0)
{ {
// Context menu of an object inside the zip
const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl); const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
if (zipEntry) if (zipEntry)
{ {
@ -473,9 +479,9 @@ public:
} }
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici) STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici)
{ {
if (!pici || pici->cbSize != sizeof(*pici)) if (!pici || (pici->cbSize != sizeof(CMINVOKECOMMANDINFO) && pici->cbSize != sizeof(CMINVOKECOMMANDINFOEX)))
return E_INVALIDARG; return E_INVALIDARG;
if (pici->lpVerb == MAKEINTRESOURCEA(0) || (HIWORD(pici->lpVerb) && !strcmp(pici->lpVerb, EXTRACT_VERBA))) if (pici->lpVerb == MAKEINTRESOURCEA(0) || (HIWORD(pici->lpVerb) && !strcmp(pici->lpVerb, EXTRACT_VERBA)))
{ {
BSTR ZipFile = m_ZipFile.AllocSysString(); BSTR ZipFile = m_ZipFile.AllocSysString();
@ -495,12 +501,18 @@ public:
{ {
int Entries = 0; int Entries = 0;
CStringW menuText(MAKEINTRESOURCEW(IDS_MENUITEM)); if (!(uFlags & CMF_DEFAULTONLY))
{
CStringW menuText(MAKEINTRESOURCEW(IDS_MENUITEM));
InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); if (indexMenu)
Entries++; {
InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_STRING, idCmdFirst++, menuText); InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
Entries++; Entries++;
}
InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_STRING, idCmdFirst++, menuText);
Entries++;
}
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Entries); return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Entries);
} }