From 026c7235f9f15146a5f8dc7b932a477d3f138e05 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 9 Apr 2017 13:51:39 +0000 Subject: [PATCH] [BROWSEUI] -Move the following classes to a new static lib called shellbars: CBandSite, CBandSiteMenu, CBaseBar, CSHEnumClassesOfCategories. - This will be linked to rshell in order to implement support for additional toolbars in the taskbar as well as floating toolbars. - In the future more classes will be added in this static lib including: CISFBand (which implements a dockable toolbar that shows the contents of a shell folder), CQuickLinks (a special CISFBand), CDeskBarApp (a special CBaseBar that implements the floating host for toolbars) and perhaps more. svn path=/trunk/; revision=74292 --- reactos/dll/win32/browseui/CMakeLists.txt | 8 +- reactos/dll/win32/browseui/browseui.cpp | 100 +++++++++++++++ reactos/dll/win32/browseui/browseui.h | 115 ++---------------- reactos/dll/win32/browseui/precomp.h | 4 +- .../{bandsite.cpp => shellbars/CBandSite.cpp} | 7 +- .../{bandsite.h => shellbars/CBandSite.h} | 0 .../CBandSiteMenu.cpp} | 7 +- .../CBandSiteMenu.h} | 0 .../{basebar.cpp => shellbars/CBaseBar.cpp} | 2 +- .../win32/browseui/shellbars/CMakeLists.txt | 22 ++++ .../CSHEnumClassesOfCategories.cpp} | 2 +- .../dll/win32/browseui/shellbars/shellbars.h | 36 ++++++ 12 files changed, 185 insertions(+), 118 deletions(-) rename reactos/dll/win32/browseui/{bandsite.cpp => shellbars/CBandSite.cpp} (99%) rename reactos/dll/win32/browseui/{bandsite.h => shellbars/CBandSite.h} (100%) rename reactos/dll/win32/browseui/{bandsitemenu.cpp => shellbars/CBandSiteMenu.cpp} (95%) rename reactos/dll/win32/browseui/{bandsitemenu.h => shellbars/CBandSiteMenu.h} (100%) rename reactos/dll/win32/browseui/{basebar.cpp => shellbars/CBaseBar.cpp} (99%) create mode 100644 reactos/dll/win32/browseui/shellbars/CMakeLists.txt rename reactos/dll/win32/browseui/{comcat.cpp => shellbars/CSHEnumClassesOfCategories.cpp} (99%) create mode 100644 reactos/dll/win32/browseui/shellbars/shellbars.h diff --git a/reactos/dll/win32/browseui/CMakeLists.txt b/reactos/dll/win32/browseui/CMakeLists.txt index b0cc60b6488..30ab6a2969e 100644 --- a/reactos/dll/win32/browseui/CMakeLists.txt +++ b/reactos/dll/win32/browseui/CMakeLists.txt @@ -1,5 +1,7 @@ PROJECT(SHELL) +add_subdirectory(shellbars) + set_cpp(WITH_RUNTIME) include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) @@ -11,9 +13,6 @@ list(APPEND SOURCE addressband.cpp addresseditbox.cpp bandproxy.cpp - bandsite.cpp - bandsitemenu.cpp - basebar.cpp basebarsite.cpp brandband.cpp browseui.cpp @@ -31,7 +30,6 @@ list(APPEND SOURCE travellog.cpp utility.cpp CProgressDialog.cpp - comcat.cpp precomp.h) add_library(browseui SHARED @@ -41,7 +39,7 @@ add_library(browseui SHARED ${CMAKE_CURRENT_BINARY_DIR}/browseui.def) set_module_type(browseui win32dll UNICODE) -target_link_libraries(browseui atlnew uuid wine) +target_link_libraries(browseui shellbars atlnew uuid wine) add_importlibs(browseui shlwapi shell32 comctl32 gdi32 ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_pch(browseui precomp.h SOURCE) add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/browseui/browseui.cpp b/reactos/dll/win32/browseui/browseui.cpp index 0d3070ca7f8..d9e05ec3343 100644 --- a/reactos/dll/win32/browseui/browseui.cpp +++ b/reactos/dll/win32/browseui/browseui.cpp @@ -20,6 +20,106 @@ #include "precomp.h" + +HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_ADDRESSBAND + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, toolsBar)); +#endif +} + +HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_ADDRESSEDITBOX + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); +#endif +} + +HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_BANDPROXY + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_BandProxy, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); +#endif +} + +HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_BRANDBAND + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv) +{ +#if USE_CUSTOM_EXPLORERBAND + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_ExplorerBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_INTERNETTOOLBAR + return ShellObjectCreator(riid, ppv); +#else + return CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); + +HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_MERGEDFOLDER + HMODULE hRShell = GetModuleHandle(L"rshell.dll"); + if (!hRShell) + hRShell = LoadLibrary(L"rshell.dll"); + + if (hRShell) + { + 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); +} + +HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv) +{ +#if USE_CUSTOM_MENUBAND + HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); + + if (!hRShell) + hRShell = LoadLibraryW(L"rshell.dll"); + + if (hRShell) + { + 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); +} + + class CBrowseUIModule : public CComModule { public: diff --git a/reactos/dll/win32/browseui/browseui.h b/reactos/dll/win32/browseui/browseui.h index 37faa9a01f6..e1d62de6478 100644 --- a/reactos/dll/win32/browseui/browseui.h +++ b/reactos/dll/win32/browseui/browseui.h @@ -9,115 +9,16 @@ #define USE_CUSTOM_EXPLORERBAND 1 #define USE_CUSTOM_INTERNETTOOLBAR 1 -/* Constructors for the classes that are not exported */ +HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv); +HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv); +HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv); +HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv); +HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv); +HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv); +HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv); HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv); HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv); HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical); HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical); HRESULT CToolsBand_CreateInstance(REFIID riid, void **ppv); - -static inline -HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_ADDRESSBAND - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, toolsBar)); -#endif -} - -static inline -HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_ADDRESSEDITBOX - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); -#endif -} - -static inline -HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_BANDPROXY - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_BandProxy, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); -#endif -} - -static inline -HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_BRANDBAND - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -static inline -HRESULT WINAPI CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv) -{ -#if USE_CUSTOM_EXPLORERBAND - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_ExplorerBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -static inline -HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_INTERNETTOOLBAR - return ShellObjectCreator(riid, ppv); -#else - return CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); -typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); - -static inline -HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_MERGEDFOLDER - HMODULE hRShell = GetModuleHandle(L"rshell.dll"); - if (!hRShell) - hRShell = LoadLibrary(L"rshell.dll"); - - if (hRShell) - { - 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 CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv) -{ -#if USE_CUSTOM_MENUBAND - HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); - - if (!hRShell) - hRShell = LoadLibraryW(L"rshell.dll"); - - if (hRShell) - { - 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); -} diff --git a/reactos/dll/win32/browseui/precomp.h b/reactos/dll/win32/browseui/precomp.h index 83a5e590291..b3323511a3e 100644 --- a/reactos/dll/win32/browseui/precomp.h +++ b/reactos/dll/win32/browseui/precomp.h @@ -40,8 +40,8 @@ #include "addresseditbox.h" #include "CAutoComplete.h" #include "bandproxy.h" -#include "bandsite.h" -#include "bandsitemenu.h" +#include "shellbars/CBandSite.h" +#include "shellbars/CBandSiteMenu.h" #include "brandband.h" #include "internettoolbar.h" #include "commonbrowser.h" diff --git a/reactos/dll/win32/browseui/bandsite.cpp b/reactos/dll/win32/browseui/shellbars/CBandSite.cpp similarity index 99% rename from reactos/dll/win32/browseui/bandsite.cpp rename to reactos/dll/win32/browseui/shellbars/CBandSite.cpp index 5e46e71855d..359a1c429d8 100644 --- a/reactos/dll/win32/browseui/bandsite.cpp +++ b/reactos/dll/win32/browseui/shellbars/CBandSite.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shellbars.h" #ifndef ASSERT #define ASSERT(cond) \ @@ -829,3 +829,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *) { return E_NOTIMPL; } + +HRESULT CBandSite_CreateInstance(REFIID riid, void **ppv) +{ + return ShellObjectCreator(riid, ppv); +} diff --git a/reactos/dll/win32/browseui/bandsite.h b/reactos/dll/win32/browseui/shellbars/CBandSite.h similarity index 100% rename from reactos/dll/win32/browseui/bandsite.h rename to reactos/dll/win32/browseui/shellbars/CBandSite.h diff --git a/reactos/dll/win32/browseui/bandsitemenu.cpp b/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp similarity index 95% rename from reactos/dll/win32/browseui/bandsitemenu.cpp rename to reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp index b10f24f1eea..23b2fa18766 100644 --- a/reactos/dll/win32/browseui/bandsitemenu.cpp +++ b/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shellbars.h" CBandSiteMenu::CBandSiteMenu() { @@ -94,3 +94,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::HandleMenuMsg2(UINT uMsg, WPARAM wParam FIXME("CBandSiteMenu::HandleMenuMsg2 is UNIMPLEMENTED(%p, %u, %p, %p, %p)\n", this, uMsg, wParam, lParam, plResult); return E_NOTIMPL; } + +HRESULT CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) +{ + return ShellObjectCreator(riid, ppv); +} diff --git a/reactos/dll/win32/browseui/bandsitemenu.h b/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.h similarity index 100% rename from reactos/dll/win32/browseui/bandsitemenu.h rename to reactos/dll/win32/browseui/shellbars/CBandSiteMenu.h diff --git a/reactos/dll/win32/browseui/basebar.cpp b/reactos/dll/win32/browseui/shellbars/CBaseBar.cpp similarity index 99% rename from reactos/dll/win32/browseui/basebar.cpp rename to reactos/dll/win32/browseui/shellbars/CBaseBar.cpp index bd84b4a7985..44d2ec5d158 100644 --- a/reactos/dll/win32/browseui/basebar.cpp +++ b/reactos/dll/win32/browseui/shellbars/CBaseBar.cpp @@ -22,7 +22,7 @@ This class knows how to contain base bar site in a cabinet window. */ -#include "precomp.h" +#include "shellbars.h" /* Base bar that contains a vertical or horizontal explorer band. It also diff --git a/reactos/dll/win32/browseui/shellbars/CMakeLists.txt b/reactos/dll/win32/browseui/shellbars/CMakeLists.txt new file mode 100644 index 00000000000..3807056b20c --- /dev/null +++ b/reactos/dll/win32/browseui/shellbars/CMakeLists.txt @@ -0,0 +1,22 @@ +PROJECT(SHELL) + +set_cpp(WITH_RUNTIME) + +add_definitions(-DUNICODE -D_UNICODE) + +include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) + +list(APPEND SOURCE + CBandSite.cpp + CBandSiteMenu.cpp + CBaseBar.cpp + CSHEnumClassesOfCategories.cpp) + +add_library(shellbars ${SOURCE}) +add_dependencies(shellbars xdk) + +if(NOT MSVC) + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_target_compile_flags(shellbars "-Wno-unused-but-set-variable") + endif() +endif() diff --git a/reactos/dll/win32/browseui/comcat.cpp b/reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp similarity index 99% rename from reactos/dll/win32/browseui/comcat.cpp rename to reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp index e660cb4e893..d47236b8ec0 100644 --- a/reactos/dll/win32/browseui/comcat.cpp +++ b/reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp @@ -22,7 +22,7 @@ * Wraps the component categories manager enum */ -#include "precomp.h" +#include "shellbars.h" #define REGPATH L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discardable\\PostSetup\\Component Categories" #define IMPLEMENTING L"Implementing" diff --git a/reactos/dll/win32/browseui/shellbars/shellbars.h b/reactos/dll/win32/browseui/shellbars/shellbars.h new file mode 100644 index 00000000000..b85d98c314f --- /dev/null +++ b/reactos/dll/win32/browseui/shellbars/shellbars.h @@ -0,0 +1,36 @@ +#ifndef _SHELLBARS_PCH_ +#define _SHELLBARS_PCH_ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../resource.h" + +#include "CBandSite.h" +#include "CBandSiteMenu.h" + +WINE_DEFAULT_DEBUG_CHANNEL(browseui); + +#endif /* _BROWSEUI_PCH_ */