2011-05-15 15:55:49 +00:00
|
|
|
/*
|
|
|
|
* provides new shell item service
|
|
|
|
*
|
2013-09-15 13:06:05 +00:00
|
|
|
* Copyright 2007 Johannes Anderwald (johannes.anderwald@reactos.org)
|
2011-05-15 15:55:49 +00:00
|
|
|
* Copyright 2009 Andrew Hill
|
2012-01-09 23:01:01 +00:00
|
|
|
* Copyright 2012 Rafal Harabien
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SHV_ITEM_NEW_H_
|
|
|
|
#define _SHV_ITEM_NEW_H_
|
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
const WCHAR ShellNewKey[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discardable\\PostSetup\\ShellNew";
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
class CNewMenu :
|
2016-07-23 12:31:30 +00:00
|
|
|
public CComCoClass<CNewMenu, &CLSID_NewMenu>,
|
|
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
|
|
public IObjectWithSite,
|
|
|
|
public IContextMenu3,
|
|
|
|
public IShellExtInit
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
private:
|
2016-07-23 12:31:30 +00:00
|
|
|
enum SHELLNEW_TYPE
|
|
|
|
{
|
|
|
|
SHELLNEW_TYPE_INVALID = -1,
|
|
|
|
SHELLNEW_TYPE_COMMAND = 1,
|
|
|
|
SHELLNEW_TYPE_DATA = 2,
|
|
|
|
SHELLNEW_TYPE_FILENAME = 4,
|
|
|
|
SHELLNEW_TYPE_NULLFILE = 8
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SHELLNEW_ITEM
|
|
|
|
{
|
|
|
|
SHELLNEW_TYPE Type;
|
|
|
|
LPWSTR pwszExt;
|
|
|
|
PBYTE pData;
|
|
|
|
ULONG cbData;
|
|
|
|
LPWSTR pwszDesc;
|
|
|
|
HICON hIcon;
|
|
|
|
SHELLNEW_ITEM *pNext;
|
|
|
|
};
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2015-09-02 13:14:46 +00:00
|
|
|
LPITEMIDLIST m_pidlFolder;
|
2012-01-09 23:01:01 +00:00
|
|
|
SHELLNEW_ITEM *m_pItems;
|
2019-04-23 01:48:34 +00:00
|
|
|
SHELLNEW_ITEM *m_pLinkItem; // Points to the link handler item in the m_pItems list.
|
2014-08-20 12:25:09 +00:00
|
|
|
CComPtr<IUnknown> m_pSite;
|
2012-01-05 23:04:06 +00:00
|
|
|
HMENU m_hSubMenu;
|
2019-04-24 01:41:41 +00:00
|
|
|
UINT m_idCmdFirst, m_idCmdFolder, m_idCmdLink;
|
2024-03-04 13:30:43 +00:00
|
|
|
BOOL m_bCustomIconFolder, m_bCustomIconLink;
|
2019-04-24 01:36:27 +00:00
|
|
|
HICON m_hIconFolder, m_hIconLink;
|
2012-01-05 23:04:06 +00:00
|
|
|
|
|
|
|
SHELLNEW_ITEM *LoadItem(LPCWSTR pwszExt);
|
|
|
|
void UnloadItem(SHELLNEW_ITEM *pItem);
|
2016-07-23 12:31:30 +00:00
|
|
|
void UnloadAllItems();
|
|
|
|
BOOL CacheItems();
|
|
|
|
BOOL LoadCachedItems();
|
|
|
|
BOOL LoadAllItems();
|
|
|
|
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
|
|
|
|
SHELLNEW_ITEM *FindItemFromIdOffset(UINT IdOffset);
|
|
|
|
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici);
|
|
|
|
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi);
|
2019-04-23 01:48:34 +00:00
|
|
|
HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename);
|
|
|
|
HRESULT NewItemByCommand(SHELLNEW_ITEM *pItem, LPCWSTR wszPath);
|
|
|
|
HRESULT NewItemByNonCommand(SHELLNEW_ITEM *pItem, LPWSTR wszName,
|
|
|
|
DWORD cchNameMax, LPCWSTR wszPath);
|
2012-01-05 23:04:06 +00:00
|
|
|
|
|
|
|
public:
|
2016-07-23 12:31:30 +00:00
|
|
|
CNewMenu();
|
|
|
|
~CNewMenu();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
// IObjectWithSite
|
2024-03-04 23:43:39 +00:00
|
|
|
STDMETHOD(SetSite)(IUnknown *pUnkSite) override;
|
|
|
|
STDMETHOD(GetSite)(REFIID riid, void **ppvSite) override;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
// IContextMenu
|
2024-03-04 23:43:39 +00:00
|
|
|
STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
|
|
|
|
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpcmi) override;
|
|
|
|
STDMETHOD(GetCommandString)(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
// IContextMenu3
|
2024-03-04 23:43:39 +00:00
|
|
|
STDMETHOD(HandleMenuMsg2)(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override;
|
2015-04-01 20:22:25 +00:00
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
// IContextMenu2
|
2024-03-04 23:43:39 +00:00
|
|
|
STDMETHOD(HandleMenuMsg)(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-07-23 12:31:30 +00:00
|
|
|
// IShellExtInit
|
2024-03-04 23:43:39 +00:00
|
|
|
STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
DECLARE_REGISTRY_RESOURCEID(IDR_NEWMENU)
|
|
|
|
DECLARE_NOT_AGGREGATABLE(CNewMenu)
|
|
|
|
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CNewMenu)
|
2016-07-23 12:31:30 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IContextMenu3, IContextMenu3)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
|
2011-05-15 15:55:49 +00:00
|
|
|
END_COM_MAP()
|
|
|
|
};
|
|
|
|
|
2014-01-25 17:24:24 +00:00
|
|
|
#endif /* _SHV_ITEM_NEW_H_ */
|