mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:12:57 +00:00
[BROWSEUI]
* Fix usage of outdated CMergedFolder to use the proper interface. svn path=/branches/shell-experiments/; revision=63847
This commit is contained in:
parent
a2cfa8dc58
commit
930d7fff14
3 changed files with 134 additions and 57 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "CMergedFolder.h"
|
#include "CMergedFolder.h"
|
||||||
|
|
||||||
|
// TODO: declare these GUIDs and interfaces in the right place (whatever that may be)
|
||||||
IID IID_IAugmentedShellFolder = { 0x91EA3F8C, 0xC99B, 0x11D0, { 0x98, 0x15, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72 } };
|
IID IID_IAugmentedShellFolder = { 0x91EA3F8C, 0xC99B, 0x11D0, { 0x98, 0x15, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72 } };
|
||||||
IID IID_IAugmentedShellFolder2 = { 0x8DB3B3F4, 0x6CFE, 0x11D1, { 0x8A, 0xE9, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0 } };
|
IID IID_IAugmentedShellFolder2 = { 0x8DB3B3F4, 0x6CFE, 0x11D1, { 0x8A, 0xE9, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0 } };
|
||||||
CLSID CLSID_MergedFolder = { 0x26FDC864, 0xBE88, 0x46E7, { 0x92, 0x35, 0x03, 0x2D, 0x8E, 0xA5, 0x16, 0x2E } };
|
CLSID CLSID_MergedFolder = { 0x26FDC864, 0xBE88, 0x46E7, { 0x92, 0x35, 0x03, 0x2D, 0x8E, 0xA5, 0x16, 0x2E } };
|
||||||
|
@ -309,7 +310,7 @@ HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder ** ppsfResult)
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetStartMenuFolder(IShellFolder ** ppsfStartMenu)
|
static HRESULT GetStartMenuFolder(IShellFolder ** ppsfStartMenu)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
LPITEMIDLIST pidlUserStartMenu;
|
LPITEMIDLIST pidlUserStartMenu;
|
||||||
|
|
|
@ -31,6 +31,22 @@ toolbar, and address band for an explorer window
|
||||||
|
|
||||||
#define USE_CUSTOM_MENUBAND 1
|
#define USE_CUSTOM_MENUBAND 1
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
// TODO: declare these GUIDs and interfaces in the right place (whatever that may be)
|
||||||
|
|
||||||
|
IID IID_IAugmentedShellFolder = { 0x91EA3F8C, 0xC99B, 0x11D0, { 0x98, 0x15, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72 } };
|
||||||
|
CLSID CLSID_MergedFolder = { 0x26FDC864, 0xBE88, 0x46E7, { 0x92, 0x35, 0x03, 0x2D, 0x8E, 0xA5, 0x16, 0x2E } };
|
||||||
|
|
||||||
|
interface IAugmentedShellFolder : public IShellFolder
|
||||||
|
{
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE AddNameSpace(LPGUID, IShellFolder *, LPCITEMIDLIST, ULONG) = 0;
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetNameSpaceID(LPCITEMIDLIST, LPGUID) = 0;
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE QueryNameSpace(ULONG, LPGUID, IShellFolder **) = 0;
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE EnumNameSpace(ULONG, PULONG) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// navigation controls and menubar just send a message to parent window
|
// navigation controls and menubar just send a message to parent window
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
|
@ -74,7 +90,11 @@ extern HRESULT CreateBandProxy(REFIID riid, void **ppv);
|
||||||
extern HRESULT CreateAddressBand(REFIID riid, void **ppv);
|
extern HRESULT CreateAddressBand(REFIID riid, void **ppv);
|
||||||
|
|
||||||
typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv);
|
typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv);
|
||||||
typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(IShellFolder* userLocal, IShellFolder* allUsers, REFIID riid, LPVOID *ppv);
|
typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv);
|
||||||
|
|
||||||
|
HMODULE hRShell = NULL;
|
||||||
|
PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = NULL;
|
||||||
|
PMENUBAND_CONSTRUCTOR pCMenuBand_Constructor = NULL;
|
||||||
|
|
||||||
HRESULT IUnknown_HasFocusIO(IUnknown * punk)
|
HRESULT IUnknown_HasFocusIO(IUnknown * punk)
|
||||||
{
|
{
|
||||||
|
@ -392,15 +412,105 @@ CMenuCallback::~CMenuCallback()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder ** ppsfResult)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
CComPtr<IShellFolder> psfDesktop;
|
||||||
|
|
||||||
|
*ppsfResult = NULL;
|
||||||
|
|
||||||
|
hr = SHGetDesktopFolder(&psfDesktop);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, ppsfResult));
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT GetFavoritesFolder(IShellFolder ** ppsfFavorites, LPITEMIDLIST * ppidl)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
LPITEMIDLIST pidlUserFavorites;
|
||||||
|
LPITEMIDLIST pidlCommonFavorites;
|
||||||
|
CComPtr<IShellFolder> psfUserFavorites;
|
||||||
|
CComPtr<IShellFolder> psfCommonFavorites;
|
||||||
|
CComPtr<IAugmentedShellFolder> pasf;
|
||||||
|
|
||||||
|
*ppsfFavorites = NULL;
|
||||||
|
|
||||||
|
hr = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidlUserFavorites);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
if (FAILED(SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_FAVORITES, &pidlCommonFavorites)))
|
||||||
|
{
|
||||||
|
hr = BindToDesktop(pidlUserFavorites, ppsfFavorites);
|
||||||
|
*ppidl = pidlUserFavorites;
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = BindToDesktop(pidlUserFavorites, &psfUserFavorites);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
hr = BindToDesktop(pidlCommonFavorites, &psfCommonFavorites);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if (!hRShell)
|
||||||
|
{
|
||||||
|
hRShell = GetModuleHandle(L"rshell.dll");
|
||||||
|
if (!hRShell)
|
||||||
|
hRShell = LoadLibrary(L"rshell.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pCMergedFolder_Constructor)
|
||||||
|
pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR) GetProcAddress(hRShell, "CMergedFolder_Constructor");
|
||||||
|
|
||||||
|
if (pCMergedFolder_Constructor)
|
||||||
|
{
|
||||||
|
hr = pCMergedFolder_Constructor(IID_PPV_ARG(IAugmentedShellFolder, &pasf));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = E_FAIL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
hr = CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IAugmentedShellFolder, &pasf));
|
||||||
|
#endif
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
{
|
||||||
|
*ppsfFavorites = psfUserFavorites.Detach();
|
||||||
|
*ppidl = pidlUserFavorites;
|
||||||
|
ILFree(pidlCommonFavorites);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pasf->AddNameSpace(NULL, psfUserFavorites, pidlUserFavorites, 0xFF00);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
hr = pasf->AddNameSpace(NULL, psfCommonFavorites, pidlCommonFavorites, 0);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
hr = pasf->QueryInterface(IID_PPV_ARG(IShellFolder, ppsfFavorites));
|
||||||
|
pasf.Release();
|
||||||
|
|
||||||
|
ILFree(pidlCommonFavorites);
|
||||||
|
ILFree(pidlUserFavorites);
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, void **ppvObject)
|
HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
CComPtr<IShellMenu> parentMenu;
|
CComPtr<IShellMenu> parentMenu;
|
||||||
CComPtr<IShellMenu> newMenu;
|
CComPtr<IShellMenu> newMenu;
|
||||||
CComPtr<IShellFolder> favoritesFolder;
|
CComPtr<IShellFolder> favoritesFolder;
|
||||||
LPITEMIDLIST favoritesPIDL;
|
LPITEMIDLIST favoritesPIDL;
|
||||||
CComPtr<IShellFolder> commonFavsFolder;
|
|
||||||
LPITEMIDLIST commonFavsPIDL;
|
|
||||||
CComPtr<IShellFolder> mergedFolder;
|
|
||||||
HWND ownerWindow;
|
HWND ownerWindow;
|
||||||
HMENU parentHMenu;
|
HMENU parentHMenu;
|
||||||
HMENU favoritesHMenu;
|
HMENU favoritesHMenu;
|
||||||
|
@ -428,12 +538,19 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
||||||
if (favoritesHMenu == NULL)
|
if (favoritesHMenu == NULL)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
#if USE_CUSTOM_MENUBAND
|
#if USE_CUSTOM_MENUBAND
|
||||||
HMODULE hrs = LoadLibrary(L"rshell.dll");
|
if (!hRShell)
|
||||||
|
|
||||||
PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hrs, "CMenuBand_Constructor");
|
|
||||||
if (func)
|
|
||||||
{
|
{
|
||||||
hResult = func(IID_PPV_ARG(IShellMenu, &newMenu));
|
hRShell = GetModuleHandle(L"rshell.dll");
|
||||||
|
if (!hRShell)
|
||||||
|
hRShell = LoadLibrary(L"rshell.dll");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pCMenuBand_Constructor)
|
||||||
|
pCMenuBand_Constructor = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hRShell, "CMenuBand_Constructor");
|
||||||
|
|
||||||
|
if (pCMenuBand_Constructor)
|
||||||
|
{
|
||||||
|
hResult = pCMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &newMenu));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -452,36 +569,15 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
||||||
hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
|
hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
hResult = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &favoritesPIDL);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
hResult = SHBindToFolder(favoritesPIDL, &favoritesFolder);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
|
RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
|
||||||
0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
|
0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
|
||||||
#if 1 /*USE_MERGED_FAVORITES*/
|
|
||||||
hResult = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_FAVORITES, &commonFavsPIDL);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
hResult = SHBindToFolder(commonFavsPIDL, &commonFavsFolder);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
ILFree(commonFavsPIDL);
|
|
||||||
|
|
||||||
PMERGEDFOLDER_CONSTRUCTOR mfconstruct = (PMERGEDFOLDER_CONSTRUCTOR) GetProcAddress(hrs, "CMergedFolder_Constructor");
|
hResult = GetFavoritesFolder(&favoritesFolder, &favoritesPIDL);
|
||||||
if (mfconstruct)
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
{
|
return hResult;
|
||||||
hResult = mfconstruct(favoritesFolder, commonFavsFolder, IID_PPV_ARG(IShellFolder, &mergedFolder));
|
|
||||||
}
|
hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
|
||||||
else
|
|
||||||
{
|
|
||||||
mergedFolder = favoritesFolder;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
mergedFolder = favoritesFolder;
|
|
||||||
#endif
|
|
||||||
hResult = newMenu->SetShellFolder(mergedFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
|
|
||||||
ILFree(favoritesPIDL);
|
ILFree(favoritesPIDL);
|
||||||
if (SUCCEEDED(hResult))
|
if (SUCCEEDED(hResult))
|
||||||
fFavoritesMenu.Attach(newMenu.Detach());
|
fFavoritesMenu.Attach(newMenu.Detach());
|
||||||
|
|
|
@ -26,14 +26,12 @@
|
||||||
extern "C"
|
extern "C"
|
||||||
BOOL WINAPI Shell_GetImageLists(
|
BOOL WINAPI Shell_GetImageLists(
|
||||||
_Out_ HIMAGELIST *phiml,
|
_Out_ HIMAGELIST *phiml,
|
||||||
_Out_ HIMAGELIST *phimlSmall
|
_Out_ HIMAGELIST *phimlSmall);
|
||||||
);
|
|
||||||
|
|
||||||
extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
|
extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
|
||||||
|
|
||||||
#include "newatlinterfaces.h"
|
#include "newatlinterfaces.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
**Provide implementation of new and delete that use LocalAlloc
|
**Provide implementation of new and delete that use LocalAlloc
|
||||||
|
@ -1853,17 +1851,8 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEM
|
||||||
{
|
{
|
||||||
HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
|
HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
|
||||||
|
|
||||||
//DbgPrint("Menu from shell32:\n");
|
|
||||||
//DbgDumpMenu(hmenuShared);
|
|
||||||
|
|
||||||
//DbgPrint("Menu from browseui:\n");
|
|
||||||
//DbgDumpMenu(mainMenu);
|
|
||||||
|
|
||||||
Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
|
Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
|
||||||
|
|
||||||
//DbgPrint("Merged menu:\n");
|
|
||||||
//DbgDumpMenu(hmenuShared);
|
|
||||||
|
|
||||||
int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
|
int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
|
||||||
Unused(itemCount3);
|
Unused(itemCount3);
|
||||||
|
|
||||||
|
@ -1880,9 +1869,6 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU h
|
||||||
CComPtr<IShellMenu> shellMenu;
|
CComPtr<IShellMenu> shellMenu;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
|
||||||
//DbgPrint("SetMenuSB:\n");
|
|
||||||
//DbgDumpMenu(hmenuShared);
|
|
||||||
|
|
||||||
if (hmenuShared && IsMenu(hmenuShared) == FALSE)
|
if (hmenuShared && IsMenu(hmenuShared) == FALSE)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
|
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||||
|
@ -3206,14 +3192,8 @@ LRESULT CShellBrowser::OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
menuIndex = 5;
|
menuIndex = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
//DbgPrint("Before relay:\n");
|
|
||||||
//DbgDumpMenu(theMenu);
|
|
||||||
|
|
||||||
LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
|
LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
|
||||||
|
|
||||||
//DbgPrint("After relay:\n");
|
|
||||||
//DbgDumpMenu(theMenu);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue