1 /* 2 * ReactOS Explorer 3 * 4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 #include "precomp.h" 22 23 24 HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv) 25 { 26 #if USE_CUSTOM_ADDRESSBAND 27 return ShellObjectCreator<CAddressBand>(riid, ppv); 28 #else 29 return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, toolsBar)); 30 #endif 31 } 32 33 HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv) 34 { 35 #if USE_CUSTOM_ADDRESSEDITBOX 36 return ShellObjectCreator<CAddressEditBox>(riid, ppv); 37 #else 38 return CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); 39 #endif 40 } 41 42 HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv) 43 { 44 #if USE_CUSTOM_BANDPROXY 45 return ShellObjectCreator<CBandProxy>(riid, ppv); 46 #else 47 return CoCreateInstance(CLSID_BandProxy, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); 48 #endif 49 } 50 51 HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv) 52 { 53 #if USE_CUSTOM_BRANDBAND 54 return ShellObjectCreator<CBrandBand>(riid, ppv); 55 #else 56 return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); 57 #endif 58 } 59 60 HRESULT CSearchBar_CreateInstance(REFIID riid, LPVOID *ppv) 61 { 62 #if USE_CUSTOM_SEARCHBAND 63 return ShellObjectCreator<CSearchBar>(riid, ppv); 64 #else 65 return CoCreateInstance(CLSID_FileSearchBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); 66 #endif 67 } 68 69 HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv) 70 { 71 #if USE_CUSTOM_EXPLORERBAND 72 return ShellObjectCreator<CExplorerBand>(riid, ppv); 73 #else 74 return CoCreateInstance(CLSID_ExplorerBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); 75 #endif 76 } 77 78 HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv) 79 { 80 #if USE_CUSTOM_INTERNETTOOLBAR 81 return ShellObjectCreator<CInternetToolbar>(riid, ppv); 82 #else 83 return CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, riid, ppv); 84 #endif 85 } 86 87 typedef HRESULT(WINAPI * PMENUBAND_CREATEINSTANCE)(REFIID riid, void **ppv); 88 typedef HRESULT(WINAPI * PMERGEDFOLDER_CREATEINSTANCE)(REFIID riid, void **ppv); 89 90 HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) 91 { 92 #if USE_CUSTOM_MERGEDFOLDER 93 HMODULE hRShell = GetModuleHandle(L"rshell.dll"); 94 if (!hRShell) 95 hRShell = LoadLibrary(L"rshell.dll"); 96 97 if (hRShell) 98 { 99 PMERGEDFOLDER_CREATEINSTANCE pCMergedFolder_CreateInstance = (PMERGEDFOLDER_CREATEINSTANCE) 100 GetProcAddress(hRShell, "CMergedFolder_CreateInstance"); 101 102 if (pCMergedFolder_CreateInstance) 103 { 104 return pCMergedFolder_CreateInstance(riid, ppv); 105 } 106 } 107 #endif 108 return CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, riid, ppv); 109 } 110 111 HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv) 112 { 113 #if USE_CUSTOM_MENUBAND 114 HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); 115 116 if (!hRShell) 117 hRShell = LoadLibraryW(L"rshell.dll"); 118 119 if (hRShell) 120 { 121 PMENUBAND_CREATEINSTANCE func = (PMENUBAND_CREATEINSTANCE) GetProcAddress(hRShell, "CMenuBand_CreateInstance"); 122 if (func) 123 { 124 return func(iid , ppv); 125 } 126 } 127 #endif 128 return CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, iid, ppv); 129 } 130 131 132 class CBrowseUIModule : public CComModule 133 { 134 public: 135 }; 136 137 138 BEGIN_OBJECT_MAP(ObjectMap) 139 OBJECT_ENTRY(CLSID_ACLCustomMRU, CACLCustomMRU) 140 OBJECT_ENTRY(CLSID_AutoComplete, CAutoComplete) 141 OBJECT_ENTRY(CLSID_ACLHistory, CACLHistory) 142 OBJECT_ENTRY(CLSID_ACLMulti, CACLMulti) 143 OBJECT_ENTRY(CLSID_ACListISF, CACListISF) 144 OBJECT_ENTRY(CLSID_SH_AddressBand, CAddressBand) 145 OBJECT_ENTRY(CLSID_AddressEditBox, CAddressEditBox) 146 OBJECT_ENTRY(CLSID_BandProxy, CBandProxy) 147 OBJECT_ENTRY(CLSID_RebarBandSite, CBandSite) 148 OBJECT_ENTRY(CLSID_BandSiteMenu, CBandSiteMenu) 149 OBJECT_ENTRY(CLSID_BrandBand, CBrandBand) 150 OBJECT_ENTRY(CLSID_CCommonBrowser, CCommonBrowser) 151 OBJECT_ENTRY(CLSID_GlobalFolderSettings, CGlobalFolderSettings) 152 OBJECT_ENTRY(CLSID_InternetToolbar, CInternetToolbar) 153 OBJECT_ENTRY(CLSID_CRegTreeOptions, CRegTreeOptions) 154 OBJECT_ENTRY(CLSID_ShellTaskScheduler, CShellTaskScheduler) 155 OBJECT_ENTRY(CLSID_TaskbarList, CTaskbarList) 156 //OBJECT_ENTRY(CLSID_ExplorerBand, CExplorerBand) // Moved to shdocvw.dll 157 OBJECT_ENTRY(CLSID_FileSearchBand, CSearchBar) 158 OBJECT_ENTRY(CLSID_ProgressDialog, CProgressDialog) 159 OBJECT_ENTRY(CLSID_ISFBand, CISFBand) 160 OBJECT_ENTRY(CLSID_FindFolder, CFindFolder) 161 OBJECT_ENTRY(CLSID_UserAssist, CUserAssist) 162 END_OBJECT_MAP() 163 164 CBrowseUIModule gModule; 165 CAtlWinModule gWinModule; 166 167 /************************************************************************* 168 * BROWSEUI DllMain 169 */ 170 STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad) 171 { 172 TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad); 173 174 if (dwReason == DLL_PROCESS_ATTACH) 175 { 176 gModule.Init(ObjectMap, hInstance, NULL); 177 DisableThreadLibraryCalls (hInstance); 178 } 179 else if (dwReason == DLL_PROCESS_DETACH) 180 { 181 gModule.Term(); 182 } 183 return TRUE; 184 } 185 186 /*********************************************************************** 187 * DllCanUnloadNow (BROWSEUI.@) 188 */ 189 STDAPI DllCanUnloadNow() 190 { 191 return gModule.DllCanUnloadNow(); 192 } 193 194 /*********************************************************************** 195 * DllGetClassObject (BROWSEUI.@) 196 */ 197 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) 198 { 199 return gModule.DllGetClassObject(rclsid, riid, ppv); 200 } 201 202 /*********************************************************************** 203 * DllRegisterServer (BROWSEUI.@) 204 */ 205 STDAPI DllRegisterServer() 206 { 207 return gModule.DllRegisterServer(FALSE); 208 } 209 210 /*********************************************************************** 211 * DllUnregisterServer (BROWSEUI.@) 212 */ 213 STDAPI DllUnregisterServer() 214 { 215 return gModule.DllUnregisterServer(FALSE); 216 } 217 218 /*********************************************************************** 219 * DllGetVersion (BROWSEUI.@) 220 */ 221 STDAPI DllGetVersion(DLLVERSIONINFO *info) 222 { 223 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n"); 224 225 /* this is what IE6 on Windows 98 reports */ 226 info->dwMajorVersion = 6; 227 info->dwMinorVersion = 0; 228 info->dwBuildNumber = 2600; 229 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS; 230 231 return NOERROR; 232 } 233