From cfac63ea85b809e26fe898d1b3f2ca768af4b333 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 17 Dec 2014 11:35:07 +0000 Subject: [PATCH] [BROWSEUI] * Simplify a lot of methods my using helpers from shlwapi. * Remove declarations for undocumented functions that are already declared in our headers. * Move definitions of IID_IAugmentedShellFolder and CLSID_MergedFolder to our headers. * Remove definitions of functions that are already implemented in shlwapi. * Add CreateMergedFolder and CreateMenuBand functions in precomp.h in order to simplify creating these objects when using rshell. svn path=/trunk/; revision=65698 --- reactos/dll/win32/browseui/addressband.cpp | 23 +-- reactos/dll/win32/browseui/bandproxy.cpp | 13 +- reactos/dll/win32/browseui/brandband.cpp | 13 +- .../dll/win32/browseui/internettoolbar.cpp | 164 ++---------------- reactos/dll/win32/browseui/precomp.h | 43 +++++ reactos/dll/win32/browseui/shellbrowser.cpp | 39 +---- reactos/dll/win32/browseui/toolsband.cpp | 10 +- reactos/include/reactos/shlguid_undoc.h | 4 + reactos/include/reactos/shlwapi_undoc.h | 21 +-- reactos/include/reactos/undocshell.h | 2 + 10 files changed, 84 insertions(+), 248 deletions(-) diff --git a/reactos/dll/win32/browseui/addressband.cpp b/reactos/dll/win32/browseui/addressband.cpp index 9b89069cbb0..47824f3ee9d 100644 --- a/reactos/dll/win32/browseui/addressband.cpp +++ b/reactos/dll/win32/browseui/addressband.cpp @@ -29,13 +29,6 @@ Implements the navigation band of the cabinet window HRESULT CreateAddressEditBox(REFIID riid, void **ppv); -extern "C" -HRESULT WINAPI SHGetImageList( - _In_ int iImageList, - _In_ REFIID riid, - _Out_ void **ppv - ); - /* TODO: ****Add command handler for show/hide Go button to OnWinEvent @@ -283,13 +276,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::ShowDW(BOOL fShow) HRESULT STDMETHODCALLTYPE CAddressBand::QueryStatus( const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) { - CComPtr oleCommandTarget; - HRESULT hResult; - - hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); + return IUnknown_QueryStatus(fAddressEditBox, *pguidCmdGroup, cCmds, prgCmds, pCmdText); } HRESULT STDMETHODCALLTYPE CAddressBand::Exec(const GUID *pguidCmdGroup, @@ -329,15 +316,9 @@ HRESULT STDMETHODCALLTYPE CAddressBand::TranslateAcceleratorIO(LPMSG lpMsg) HRESULT STDMETHODCALLTYPE CAddressBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg) { - CComPtr inputObjectSite; - HRESULT hResult; - if (fActivate) { - hResult = fSite->QueryInterface(IID_PPV_ARG(IInputObjectSite, &inputObjectSite)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = inputObjectSite->OnFocusChangeIS(static_cast(this), fActivate); + IUnknown_OnFocusChangeIS(fSite, static_cast(this), fActivate); SetFocus(); } return S_OK; diff --git a/reactos/dll/win32/browseui/bandproxy.cpp b/reactos/dll/win32/browseui/bandproxy.cpp index 4da31b25e08..0a145070d84 100644 --- a/reactos/dll/win32/browseui/bandproxy.cpp +++ b/reactos/dll/win32/browseui/bandproxy.cpp @@ -37,20 +37,15 @@ CBandProxy::~CBandProxy() HRESULT CBandProxy::FindBrowserWindow(IUnknown **browser) { - CComPtr serviceProvider; - CComPtr webBrowser; - HRESULT hResult; + IWebBrowser2* webBrowser; + HRESULT hResult; if (browser == NULL) return E_POINTER; - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); + hResult = IUnknown_QueryService(fSite, SID_IWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &webBrowser)); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; - hResult = serviceProvider->QueryService( - SID_IWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &webBrowser)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - *browser = webBrowser.Detach(); + *browser = webBrowser; return S_OK; } diff --git a/reactos/dll/win32/browseui/brandband.cpp b/reactos/dll/win32/browseui/brandband.cpp index 223d55891d3..a49efde467d 100644 --- a/reactos/dll/win32/browseui/brandband.cpp +++ b/reactos/dll/win32/browseui/brandband.cpp @@ -43,17 +43,6 @@ inline void FillSolidRect(HDC dc, const RECT *bounds, COLORREF clr) ::ExtTextOut(dc, 0, 0, ETO_OPAQUE, bounds, NULL, 0, NULL); } -long GetScreenDepth() -{ - HDC tempDC; - long depth; - - tempDC = GetDC(NULL); - depth = GetDeviceCaps(tempDC, BITSPIXEL) * GetDeviceCaps(tempDC, PLANES); - ReleaseDC(NULL, tempDC); - return depth; -} - static const int gSmallImageSize = 22; static const int gMediumImageSize = 26; static const int gLargeImageSize = 38; @@ -100,7 +89,7 @@ void CBrandBand::SelectImage() BITMAP bitmapInfo; int resourceID; - screenDepth = GetScreenDepth(); + screenDepth = SHGetCurColorRes(); GetClientRect(&clientRect); clientWidth = clientRect.right - clientRect.left; clientHeight = clientRect.bottom - clientRect.top; diff --git a/reactos/dll/win32/browseui/internettoolbar.cpp b/reactos/dll/win32/browseui/internettoolbar.cpp index bda3caf2e37..f89dfa5c886 100644 --- a/reactos/dll/win32/browseui/internettoolbar.cpp +++ b/reactos/dll/win32/browseui/internettoolbar.cpp @@ -29,14 +29,7 @@ toolbar, and address band for an explorer window #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -#define USE_CUSTOM_MENUBAND 1 -HMODULE g_hRShell = NULL; - #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 { @@ -90,35 +83,6 @@ extern HRESULT CreateBrandBand(REFIID riid, void **ppv); extern HRESULT CreateBandProxy(REFIID riid, void **ppv); extern HRESULT CreateAddressBand(REFIID riid, void **ppv); -typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **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) -{ - CComPtr pio; - HRESULT hr; - hr = punk->QueryInterface(IID_PPV_ARG(IInputObject, &pio)); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - return pio->HasFocusIO(); -} - -HRESULT IUnknown_TranslateAcceleratorIO(IUnknown * punk, MSG * pmsg) -{ - CComPtr pio; - HRESULT hr; - if (!punk) - return E_FAIL; - hr = punk->QueryInterface(IID_PPV_ARG(IInputObject, &pio)); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - return pio->TranslateAcceleratorIO(pmsg); -} - HRESULT IUnknown_RelayWinEvent(IUnknown * punk, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) { CComPtr menuWinEventHandler; @@ -478,28 +442,7 @@ static HRESULT GetFavoritesFolder(IShellFolder ** ppsfFavorites, LPITEMIDLIST * 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 + hr = CreateMergedFolder(IID_PPV_ARG(IAugmentedShellFolder, &pasf)); if (FAILED_UNEXPECTEDLY(hr)) { *ppsfFavorites = psfUserFavorites.Detach(); @@ -560,30 +503,7 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v if (fFavoritesMenu.p == NULL) { -#if USE_CUSTOM_MENUBAND - if (!hRShell) - { - 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 - { - hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &newMenu)); - } -#else - hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &newMenu)); -#endif + hResult = CreateMenuBand(IID_PPV_ARG(IShellMenu, &newMenu)); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED); @@ -751,29 +671,9 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **pMenuBar) *pMenuBar = NULL; - hResult = E_FAIL; -#if USE_CUSTOM_MENUBAND - if (!g_hRShell) g_hRShell = GetModuleHandleW(L"rshell.dll"); - - if (!g_hRShell) g_hRShell = LoadLibraryW(L"rshell.dll"); - - if (g_hRShell) - { - PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(g_hRShell, "CMenuBand_Constructor"); - if (func) - { - hResult = func(IID_PPV_ARG(IShellMenu, &menubar)); - } - } -#endif - + hResult = CreateMenuBand(IID_PPV_ARG(IShellMenu, &menubar)); if (FAILED_UNEXPECTEDLY(hResult)) - { - hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &menubar)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - } + return hResult; hResult = fMenuCallback->QueryInterface(IID_PPV_ARG(IShellMenuCallback, &callback)); if (FAILED_UNEXPECTEDLY(hResult)) @@ -1403,8 +1303,6 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::OnChange(LONG lEvent, LPCITEMIDLIST HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite) { CComPtr browserService; - CComPtr serviceProvider; - CComPtr oleWindow; HWND ownerWindow; HWND dockContainer; HRESULT hResult; @@ -1419,10 +1317,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite) else { // get window handle of owner - hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = oleWindow->GetWindow(&ownerWindow); + hResult = IUnknown_GetWindow(pUnkSite, &ownerWindow); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; if (ownerWindow == NULL) @@ -1447,9 +1342,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite) return E_FAIL; // take advice to watch events - hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - hResult = serviceProvider->QueryService( - SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); + hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); hResult = AtlAdvise(browserService, static_cast(this), DIID_DWebBrowserEvents, &fAdviseCookie); } return S_OK; @@ -1467,7 +1360,6 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetSite(REFIID riid, void **ppvSite) HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) { - CComPtr serviceProvider; HRESULT hResult; if (IsEqualIID(guidService, IID_IBandSite)) @@ -1577,15 +1469,10 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetBandSiteInfo(BANDSITEINFO *pbsinf LRESULT CInternetToolbar::OnTravelBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { - CComPtr serviceProvider; CComPtr webBrowser; HRESULT hResult; - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - if (FAILED_UNEXPECTEDLY(hResult)) - return 0; - hResult = serviceProvider->QueryService(SID_SShellBrowser, - IID_PPV_ARG(IWebBrowser, &webBrowser)); + hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IWebBrowser, &webBrowser)); if (FAILED_UNEXPECTEDLY(hResult)) return 0; hResult = webBrowser->GoBack(); @@ -1594,15 +1481,10 @@ LRESULT CInternetToolbar::OnTravelBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, LRESULT CInternetToolbar::OnTravelForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { - CComPtr serviceProvider; CComPtr webBrowser; HRESULT hResult; - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - if (FAILED_UNEXPECTEDLY(hResult)) - return 0; - hResult = serviceProvider->QueryService( - SID_SShellBrowser, IID_PPV_ARG(IWebBrowser, &webBrowser)); + hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IWebBrowser, &webBrowser)); if (FAILED_UNEXPECTEDLY(hResult)) return 0; hResult = webBrowser->GoForward(); @@ -1611,13 +1493,7 @@ LRESULT CInternetToolbar::OnTravelForward(WORD wNotifyCode, WORD wID, HWND hWndC LRESULT CInternetToolbar::OnUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { - CComPtr oleCommandTarget; - HRESULT hResult; - - hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL); + IUnknown_Exec(fSite, CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL); return 1; } @@ -1654,13 +1530,7 @@ LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) { - CComPtr oleCommandTarget; - HRESULT hResult; - - hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL); + IUnknown_Exec(fSite, CGID_Explorer, 0x23, 0, NULL, NULL); return 1; } @@ -1677,7 +1547,6 @@ LRESULT CInternetToolbar::OnForwardToCommandTarget(WORD wNotifyCode, WORD wID, H LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled) { - CComPtr serviceProvider; CComPtr browserService; CComPtr commandTarget; CComPtr travelLog; @@ -1703,14 +1572,11 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH { case IDM_GOTO_BACK: newMenu = CreatePopupMenu(); - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - hResult = serviceProvider->QueryService( - SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); + hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); hResult = browserService->GetTravelLog(&travelLog); hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_BACK); - hResult = browserService->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget)); commandInfo.cmdID = 0x1d; - hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL); + hResult = IUnknown_QueryStatus(browserService, CGID_Explorer, 1, &commandInfo, NULL); if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED && travelLog->CountEntries(browserService) > 1) { @@ -1733,13 +1599,11 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH break; case IDM_GOTO_FORWARD: newMenu = CreatePopupMenu(); - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); + hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); hResult = browserService->GetTravelLog(&travelLog); hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_FORE); - hResult = browserService->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget)); commandInfo.cmdID = 0x1d; - hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL); + hResult = IUnknown_QueryStatus(browserService, CGID_Explorer, 1, &commandInfo, NULL); if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED && travelLog->CountEntries(browserService) > 1) { diff --git a/reactos/dll/win32/browseui/precomp.h b/reactos/dll/win32/browseui/precomp.h index bfebc0d519e..8dd534c8c81 100644 --- a/reactos/dll/win32/browseui/precomp.h +++ b/reactos/dll/win32/browseui/precomp.h @@ -46,4 +46,47 @@ WINE_DEFAULT_DEBUG_CHANNEL(browseui); + +#define USE_CUSTOM_MENUBAND 1 + +typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); + +static inline +HRESULT CreateMergedFolder(REFIID riid, void **ppv) +{ +#if 1 + HMODULE hRShell = GetModuleHandle(L"rshell.dll"); + if (!hRShell) + hRShell = LoadLibrary(L"rshell.dll"); + + PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR) + GetProcAddress(hRShell, "CMergedFolder_Constructor"); + + if (pCMergedFolder_Constructor) + { + return pCMergedFolder_Constructor(riid, ppv); + } +#endif + return CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +} + +static inline +HRESULT CreateMenuBand(REFIID iid, LPVOID *ppv) +{ +#if USE_CUSTOM_MENUBAND + HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); + + if (!hRShell) + hRShell = LoadLibraryW(L"rshell.dll"); + + PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hRShell, "CMenuBand_Constructor"); + if (func) + { + return func(iid , ppv); + } +#endif + return CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, iid, ppv); +} + #endif /* _BROWSEUI_PCH_ */ diff --git a/reactos/dll/win32/browseui/shellbrowser.cpp b/reactos/dll/win32/browseui/shellbrowser.cpp index 41a8ed89469..2cbc5aa248e 100644 --- a/reactos/dll/win32/browseui/shellbrowser.cpp +++ b/reactos/dll/win32/browseui/shellbrowser.cpp @@ -26,11 +26,6 @@ #define USE_CUSTOM_EXPLORERBAND 1 -extern "C" -BOOL WINAPI Shell_GetImageLists( - _Out_ HIMAGELIST *phiml, - _Out_ HIMAGELIST *phimlSmall); - extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow); #include "newatlinterfaces.h" @@ -149,34 +144,6 @@ extern HRESULT CreateBaseBarSite(REFIID riid, void **ppv); // temporary extern HRESULT CreateInternetToolbar(REFIID riid, void **ppv); - -HMENU SHGetMenuFromID(HMENU topMenu, int theID) -{ - MENUITEMINFO menuItemInfo; - - menuItemInfo.cbSize = sizeof(menuItemInfo); - menuItemInfo.fMask = MIIM_SUBMENU; - if (!GetMenuItemInfo(topMenu, theID, FALSE, &menuItemInfo)) - return NULL; - return menuItemInfo.hSubMenu; -} - -void SHCheckMenuItem(HMENU theMenu, int theID, BOOL checked) -{ - MENUITEMINFO menuItemInfo; - - menuItemInfo.cbSize = sizeof(menuItemInfo); - menuItemInfo.fMask = MIIM_STATE; - if (GetMenuItemInfo(theMenu, theID, FALSE, &menuItemInfo)) - { - if (checked) - menuItemInfo.fState |= MF_CHECKED; - else - menuItemInfo.fState &= ~MF_CHECKED; - SetMenuItemInfo(theMenu, theID, FALSE, &menuItemInfo); - } -} - void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete) { MENUITEMINFO menuItemInfo; @@ -985,9 +952,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder, ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0); // set site - hResult = newShellView->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite)); - if (SUCCEEDED(hResult) && objectWithSite.p != NULL) - hResult = objectWithSite->SetSite(static_cast(this)); + hResult = IUnknown_SetSite(newShellView, static_cast(this)); // update folder and view saveCurrentShellFolder = fCurrentShellFolder; @@ -2582,8 +2547,6 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd return E_NOTIMPL; } -extern HRESULT IUnknown_HasFocusIO(IUnknown * punk); -extern HRESULT IUnknown_TranslateAcceleratorIO(IUnknown * punk, MSG * pmsg); HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg) { for (int i = 0; i < 3; i++) diff --git a/reactos/dll/win32/browseui/toolsband.cpp b/reactos/dll/win32/browseui/toolsband.cpp index 0410109db8d..259db7f9a24 100644 --- a/reactos/dll/win32/browseui/toolsband.cpp +++ b/reactos/dll/win32/browseui/toolsband.cpp @@ -261,7 +261,6 @@ TBBUTTON tbButtonsAdd[numShownButtons + numHiddenButtons] = HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite){ HWND parentWindow; - IOleWindow *oleWindow; HWND toolbar; HRESULT hResult; @@ -273,13 +272,8 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite){ if (FAILED_UNEXPECTEDLY(hResult)) return hResult; parentWindow = NULL; - hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow)); - if (SUCCEEDED(hResult)) - { - oleWindow->GetWindow(&parentWindow); - oleWindow->Release(); - } - if (!::IsWindow(parentWindow)) + hResult = IUnknown_GetWindow(pUnkSite, &parentWindow); + if (FAILED(hResult) || !::IsWindow(parentWindow)) return E_FAIL; toolbar = CreateWindowEx( diff --git a/reactos/include/reactos/shlguid_undoc.h b/reactos/include/reactos/shlguid_undoc.h index 09eb3236f42..f38a840aad3 100644 --- a/reactos/include/reactos/shlguid_undoc.h +++ b/reactos/include/reactos/shlguid_undoc.h @@ -107,6 +107,10 @@ DEFINE_GUID(CLSID_ShellNetDefExt, 0x86422020, 0x42A0, 0x1069, 0xA2, 0xE DEFINE_GUID(CLSID_ExeDropHandler, 0x86C86720, 0x42A0, 0x1069, 0xA2, 0xE8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D); +DEFINE_GUID(IID_IAugmentedShellFolder, 0x91EA3F8C, 0xC99B, 0x11D0, 0x98, 0x15, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72); +DEFINE_GUID(CLSID_MergedFolder, 0x26FDC864, 0xBE88, 0x46E7, 0x92, 0x35, 0x03, 0x2D, 0x8E, 0xA5, 0x16, 0x2E); + + #define CGID_IExplorerToolbar IID_IExplorerToolbar #define SID_IExplorerToolbar IID_IExplorerToolbar #define SID_ITargetFrame2 IID_ITargetFrame2 diff --git a/reactos/include/reactos/shlwapi_undoc.h b/reactos/include/reactos/shlwapi_undoc.h index aaaede35a62..6e6edae2fb8 100644 --- a/reactos/include/reactos/shlwapi_undoc.h +++ b/reactos/include/reactos/shlwapi_undoc.h @@ -33,13 +33,6 @@ LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT wMask, UINT wFlags); HWND WINAPI SHSetParentHwnd(HWND hWnd, HWND hWndParent); HRESULT WINAPI ConnectToConnectionPoint(IUnknown *lpUnkSink, REFIID riid, BOOL bAdviseOnly, IUnknown *lpUnknown, LPDWORD lpCookie, IConnectionPoint **lppCP); BOOL WINAPI SHIsSameObject(IUnknown *lpInt1, IUnknown *lpInt2); -HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd); -HRESULT WINAPI IUnknown_SetOwner(IUnknown *pUnk, ULONG arg); -HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site); -HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *lpClassId); -HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID riid, LPVOID *lppOut); -HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut); -HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg); BOOL WINAPI SHLoadMenuPopup(HINSTANCE hInst, LPCWSTR szName); void WINAPI SHPropagateMessage(HWND hWnd, UINT uiMsgId, WPARAM wParam, LPARAM lParam, BOOL bSend); DWORD WINAPI SHRemoveAllSubMenus(HMENU hMenu); @@ -47,9 +40,6 @@ UINT WINAPI SHEnableMenuItem(HMENU hMenu, UINT wItemID, BOOL bEnable); DWORD WINAPI SHCheckMenuItem(HMENU hMenu, UINT uID, BOOL bCheck); DWORD WINAPI SHRegisterClassA(WNDCLASSA *wndclass); BOOL WINAPI SHSimulateDrop(IDropTarget *pDrop, IDataObject *pDataObj, DWORD grfKeyState, PPOINTL lpPt, DWORD* pdwEffect); -HRESULT WINAPI IUnknown_TranslateAcceleratorOCS(IUnknown *lpUnknown, LPMSG lpMsg, DWORD dwModifiers); -HRESULT WINAPI IUnknown_OnFocusOCS(IUnknown *lpUnknown, BOOL fGotFocus); -HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1, PVOID lpArg2, PVOID lpArg3, PVOID lpArg4); HMENU WINAPI SHGetMenuFromID(HMENU hMenu, UINT uID); DWORD WINAPI SHGetCurColorRes(void); DWORD WINAPI SHWaitForSendMessageThread(HANDLE hand, DWORD dwTimeout); @@ -84,6 +74,17 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle #define SHCreateWorkerWindow SHCreateWorkerWindowA #endif +HRESULT WINAPI IUnknown_SetOwner(IUnknown *pUnk, ULONG arg); +HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *lpClassId); +HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut); +HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg); +HRESULT WINAPI IUnknown_TranslateAcceleratorOCS(IUnknown *lpUnknown, LPMSG lpMsg, DWORD dwModifiers); +HRESULT WINAPI IUnknown_OnFocusOCS(IUnknown *lpUnknown, BOOL fGotFocus); +HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1, PVOID lpArg2, PVOID lpArg3, PVOID lpArg4); +HRESULT WINAPI IUnknown_HasFocusIO(IUnknown * punk); +HRESULT WINAPI IUnknown_TranslateAcceleratorIO(IUnknown * punk, MSG * pmsg); +HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus); + #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */ diff --git a/reactos/include/reactos/undocshell.h b/reactos/include/reactos/undocshell.h index a70b075f321..fc078ea6eef 100644 --- a/reactos/include/reactos/undocshell.h +++ b/reactos/include/reactos/undocshell.h @@ -540,6 +540,8 @@ BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey); #define SMC_EXEC 4 INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc); +HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv); + static inline ULONG Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) {