ReactOS  0.4.14-dev-1331-g167fa2c
shellbrowser.cpp
Go to the documentation of this file.
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 #include <shellapi.h>
24 #include <htiframe.h>
25 #include <strsafe.h>
26 
27 extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
28 
29 #include "newatlinterfaces.h"
30 
31 /*
32 TODO:
33  **Provide implementation of new and delete that use LocalAlloc
34  **Persist history for shell view isn't working correctly, possibly because of the mismatch between traveling and updating the travel log. The
35  view doesn't restore the selection correctly.
36  **Build explorer.exe, browseui.dll, comctl32.dll, shdocvw.dll, shell32.dll, shlwapi.dll into a directory and run them for testing...
37  **Add brand band bitmaps to shell32.dll
38  **If Go button on address bar is clicked, each time a new duplicate entry is added to travel log
39 ****The current entry is updated in travel log before doing the travel, which means when traveling back the update of the
40  current state overwrites the wrong entry's contents. This needs to be changed.
41 ****Fix close of browser window to release all objects
42 ****Given only a GUID in ShowBrowserBar, what is the correct way to determine if the bar is vertical or horizontal?
43  **When a new bar is added to base bar site, how is base bar told so it can resize?
44  **Does the base bar site have a classid?
45  **What should refresh command send to views to make them refresh?
46  **When new bar is created, what status notifications need to be fired?
47  **How does keyboard filtering dispatch?
48  **For deferred persist history load, how does the view connect up and get the state?
49  How does context menu send open, cut, rename commands to its site (the shell view)?
50  **Fix browser to implement IProfferService and hold onto brand band correctly - this will allow animations.
51 
52  **Route View->Toolbars commands to internet toolbar
53  **Handle travel log items in View->Go
54  **Fix ShowBrowserBar to pass correct size on when bar is shown
55 ****Fix SetBorderSpaceDW to cascade resize to subsequent bars
56 ****Make ShowToolbar check if bar is already created before creating it again
57 ****Shell should fill in the list of explorer bars in the View submenus
58  **Add folder menu in the file menu
59  **Fix CShellBrowser::GetBorderDW to compute available size correctly
60  **When a new bar is shown, re-fire the navigate event. This makes the explorer band select the correct folder
61  **Implement support for refresh. Forward refresh to explorer bar (refresh on toolbar and in menu is dispatched different)
62  Make folders toolbar item update state appropriately
63  Read list of bands from registry on launch
64  Read list of bars from registry on launch
65  If the folders or search bars don't exist, disable the toolbar buttons
66  If the favorites or history bars don't exist, disable the toolbar butons
67  Fix Apply to all Folders in Folder Options
68  Implement close command
69  Add explorer band context menu to file menu
70  Add code to allow restore of internet toolbar from registry
71  Fix code that calls FireNavigateComplete to pass the correct new path
72 
73  What are the other command ids for QueryStatus/FireCommandStateChange?
74 
75  Add handler for cabinet settings change
76  Add handler for system metrics change (renegotiate border space?)
77  Add handler for theme change and forward to contained windows
78 
79  When folders are shown, the status bar text should change
80  Add code to save/restore shell view settings
81  Implement tabbing between frames
82  Fix handling of focus everywhere
83  Most keyboard shortcuts don't work, such as F2 for rename, F5 for refresh (see list in "explorer keyboard shortcuts")
84 
85  The status bar doesn't show help text for items owned by frame during menu tracking
86  Stub out frame command handlers
87  "Arrange icons by" group is not checked properly
88 
89  When folders are hidden, icon is the same as the current shell object being displayed. When folders are shown,
90  the icon is always an open folder with magnifying glass
91  Fix bars to calculate height correctly
92  Hookup policies for everything...
93  Investigate toolbar message WM_USER+93
94  Investigate toolbar message WM_USER+100 (Adds extra padding between parts of buttons with BTNS_DROPDOWN | BTNS_SHOWTEXT style
95 
96  Vertical Explorer Bar CATID_InfoBand
97  Horizontal Explorer Bar CATID_CommBand
98  Desk Band CATID_DeskBand
99 
100  cache of bars
101  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}\Enum
102  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}\Enum
103 
104  create key here with CLSID of bar to register tool band
105  HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Toolbar
106 
107 */
108 
109 #ifndef __GNUC__
110 #pragma comment(linker, \
111  "\"/manifestdependency:type='Win32' "\
112  "name='Microsoft.Windows.Common-Controls' "\
113  "version='6.0.0.0' "\
114  "processorArchitecture='*' "\
115  "publicKeyToken='6595b64144ccf1df' "\
116  "language='*'\"")
117 #endif // __GNUC__
118 
119 static const unsigned int folderOptionsPageCountMax = 20;
120 static const long BTP_DONT_UPDATE_HISTORY = 0;
121 static const long BTP_UPDATE_CUR_HISTORY = 1;
122 static const long BTP_UPDATE_NEXT_HISTORY = 2;
123 
125 
126 
127 // this class is private to browseui.dll and is not registered externally?
128 //DEFINE_GUID(CLSID_ShellFldSetExt, 0x6D5313C0, 0x8C62, 0x11D1, 0xB2, 0xCD, 0x00, 0x60, 0x97, 0xDF, 0x8C, 0x11);
129 
130 void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
131 {
132  MENUITEMINFO menuItemInfo;
133  int menuItemCount;
134  int curIndex;
135 
136  menuItemCount = GetMenuItemCount(theMenu);
137  curIndex = 0;
138  while (curIndex < menuItemCount)
139  {
140  menuItemInfo.cbSize = sizeof(menuItemInfo);
141  menuItemInfo.fMask = MIIM_ID;
142  if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
143  menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
144  {
145  DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
146  menuItemCount--;
147  }
148  else
149  curIndex++;
150  }
151 }
152 
154 {
155  CComPtr<IShellFolder> desktop;
156 
157  HRESULT hr = ::SHGetDesktopFolder(&desktop);
158  if (FAILED_UNEXPECTEDLY(hr))
159  return E_FAIL;
160  if (path == NULL || path->mkid.cb == 0)
161  {
162  *newFolder = desktop;
163  desktop.p->AddRef ();
164  return S_OK;
165  }
166  return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
167 }
168 
169 static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClass");
170 //static const TCHAR szExploreWndClass[] = TEXT("ExploreWClass");
171 
172 class CDockManager;
173 class CShellBrowser;
174 
176  public CWindowImpl<CToolbarProxy, CWindow, CControlWinTraits>
177 {
178 private:
180 public:
181  void Initialize(HWND parent, IUnknown *explorerToolbar);
182  void Destroy();
183 private:
184 
185  // message handlers
186  LRESULT OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
188 
192  END_MSG_MAP()
193 };
194 
196 {
197  HWND myWindow;
198  HRESULT hResult;
199 
200  myWindow = SHCreateWorkerWindowW(0, parent, 0, WS_CHILD, NULL, 0);
201  if (myWindow != NULL)
202  {
203  SubclassWindow(myWindow);
204  SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
205  hResult = explorerToolbar->QueryInterface(
206  IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
207  }
208 }
209 
211 {
212  DestroyWindow();
214 }
215 
217 {
218  long int result;
219  HRESULT hResult;
220 
221  result = 0;
222  if (fExplorerToolbar.p != NULL)
223  {
224  hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 1, (long)wParam,
225  reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
226  hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 2, (long)wParam,
227  reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
228  }
229  return result;
230 }
231 
233 {
234  LRESULT result;
235  HRESULT hResult;
236 
237  result = 0;
238  if (fExplorerToolbar.p != NULL)
239  hResult = fExplorerToolbar->SendToolbarMsg(&CGID_ShellBrowser, uMsg, wParam, lParam, &result);
240  return result;
241 }
242 
243 /*
244 Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
245  where vaIn will be a VT_UNKNOWN with the new bar. It also sends a RB_SHOWBAND to the
246  rebar
247 */
248 
249 struct MenuBandInfo {
252 };
253 
255  public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
256  public CComObjectRootEx<CComMultiThreadModelNoCS>,
257  public IShellBrowser,
258  public IDropTarget,
259  public IServiceProvider,
260  public IProfferServiceImpl<CShellBrowser>,
261  public IShellBrowserService,
262  public IWebBrowser2,
263  public ITravelLogClient,
264  public IPersistHistory,
265  public IDockingWindowSite,
266  public IOleCommandTarget,
267  public IBrowserService2,
268  public IConnectionPointContainerImpl<CShellBrowser>,
269  public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>,
270  public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>
271 {
272 private:
273  class barInfo
274  {
275  public:
277  {
278  memset(&borderSpace, 0, sizeof(borderSpace));
279  hwnd = NULL;
280  }
281 
285  };
286  static const int BIInternetToolbar = 0;
287  static const int BIVerticalBaseBar = 1;
288  static const int BIHorizontalBaseBar = 2;
289 
290  HWND fCurrentShellViewWindow; // our currently hosted shell view window
301  GUID fCurrentVertBar; //The guid of the built in vertical bar that is being shown
302  // The next three fields support persisted history for shell views.
303  // They do not need to be reference counted.
308  HACCEL m_hAccel;
309 public:
310 #if 0
312  {
313  OutputDebugString(_T("AddRef\n"));
315  }
317  {
318  OutputDebugString(_T("Release\n"));
320  }
321 #endif
322 
323  CShellBrowser();
324  ~CShellBrowser();
326 public:
328  HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
329  FOLDERSETTINGS *folderSettings, long flags);
330  HRESULT GetMenuBand(REFIID riid, void **shellMenu);
331  HRESULT GetBaseBar(bool vertical, REFIID riid, void **theBaseBar);
332  BOOL IsBandLoaded(const CLSID clsidBand, bool verticali, DWORD *pdwBandID);
333  HRESULT ShowBand(const CLSID &classID, bool vertical);
337  void RepositionBars();
339  HRESULT BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound);
340  BOOL IsBuiltinBand(CLSID &bandID);
342  {
343  return WindowProc;
344  }
345  HRESULT FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments);
346  HRESULT FireNavigateComplete(const wchar_t *newDirectory);
347  HRESULT FireCommandStateChange(bool newState, int commandID);
351  void UpdateGotoMenu(HMENU theMenu);
352  void UpdateViewMenu(HMENU theMenu);
353 
354 /* // *** IDockingWindowFrame methods ***
355  virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags);
356  virtual HRESULT STDMETHODCALLTYPE RemoveToolbar(IUnknown *punkSrc, DWORD dwRemoveFlags);
357  virtual HRESULT STDMETHODCALLTYPE FindToolbar(LPCWSTR pwszItem, REFIID riid, void **ppv);
358  */
359 
360  // *** IDockingWindowSite methods ***
361  virtual HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkObj, LPRECT prcBorder);
362  virtual HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
363  virtual HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
364 
365  // *** IOleCommandTarget methods ***
366  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
367  OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
368  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
369  DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
370 
371  // *** IOleWindow methods ***
372  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
374 
375  // *** IShellBrowser methods ***
376  virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
377  virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject);
378  virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared);
379  virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText);
383  virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm);
384  virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd);
388  virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags);
389 
390  // *** IDropTarget methods ***
391  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
392  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
394  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
395 
396  // *** IServiceProvider methods ***
397  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
398 
399  // *** IShellBowserService methods ***
401 
402  // *** IDispatch methods ***
404  virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
406  REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
407  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
408  DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
409 
410  // *** IBrowserService methods ***
412  virtual HRESULT STDMETHODCALLTYPE SetTitle(IShellView *psv, LPCWSTR pszName);
419  virtual HRESULT STDMETHODCALLTYPE IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut);
424  virtual HRESULT STDMETHODCALLTYPE NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse);
427  virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags, DWORD dwFlagMask);
428  virtual HRESULT STDMETHODCALLTYPE GetFlags(DWORD *pdwFlags);
434  virtual HRESULT STDMETHODCALLTYPE GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc);
435  virtual HRESULT STDMETHODCALLTYPE SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor);
437  virtual HRESULT STDMETHODCALLTYPE GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut);
438  virtual HRESULT STDMETHODCALLTYPE OnHttpEquiv(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut);
439  virtual HRESULT STDMETHODCALLTYPE GetPalette(HPALETTE *hpal);
440  virtual HRESULT STDMETHODCALLTYPE RegisterWindow(BOOL fForceRegister, int swc);
441 
442  // *** IBrowserService2 methods ***
447  virtual HRESULT STDMETHODCALLTYPE OnCreate(struct tagCREATESTRUCTW *pcs);
450  virtual LRESULT STDMETHODCALLTYPE OnNotify(struct tagNMHDR *pnm);
455  virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd);
457  virtual HRESULT STDMETHODCALLTYPE GetViewWindow(HWND *phwndView);
462  virtual HRESULT STDMETHODCALLTYPE Offline(int iCmd);
465  virtual HRESULT STDMETHODCALLTYPE UpdateSecureLockIcon(int eSecureLock);
477  virtual HRESULT STDMETHODCALLTYPE _ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup,
478  DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
480  HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam);
485  virtual HRESULT STDMETHODCALLTYPE _put_itbLastFocus(UINT itbLastFocus);
492  virtual IStream *STDMETHODCALLTYPE v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName);
494  virtual HRESULT STDMETHODCALLTYPE SetAcceleratorMenu(HACCEL hacc);
495  virtual int STDMETHODCALLTYPE _GetToolbarCount();
501  int citb, LPTOOLBARITEM *pptbi, HWND *phwnd);
502  virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor);
503  virtual UINT STDMETHODCALLTYPE _FindTBar(IUnknown *punkSrc);
506  virtual HRESULT STDMETHODCALLTYPE _GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor);
508 
509  // *** IWebBrowser methods ***
510  virtual HRESULT STDMETHODCALLTYPE GoBack();
512  virtual HRESULT STDMETHODCALLTYPE GoHome();
514  virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName,
515  VARIANT *PostData, VARIANT *Headers);
518  virtual HRESULT STDMETHODCALLTYPE Stop();
520  virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch **ppDisp);
525  virtual HRESULT STDMETHODCALLTYPE get_Left(long *pl);
526  virtual HRESULT STDMETHODCALLTYPE put_Left(long Left);
527  virtual HRESULT STDMETHODCALLTYPE get_Top(long *pl);
528  virtual HRESULT STDMETHODCALLTYPE put_Top(long Top);
529  virtual HRESULT STDMETHODCALLTYPE get_Width(long *pl);
530  virtual HRESULT STDMETHODCALLTYPE put_Width(long Width);
531  virtual HRESULT STDMETHODCALLTYPE get_Height(long *pl);
532  virtual HRESULT STDMETHODCALLTYPE put_Height(long Height);
533  virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR *LocationName);
534  virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR *LocationURL);
536 
537  // *** IWebBrowserApp methods ***
538  virtual HRESULT STDMETHODCALLTYPE Quit();
539  virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int *pcx, int *pcy);
550  virtual HRESULT STDMETHODCALLTYPE get_StatusText(BSTR *StatusText);
551  virtual HRESULT STDMETHODCALLTYPE put_StatusText(BSTR StatusText);
556  virtual HRESULT STDMETHODCALLTYPE get_FullScreen(VARIANT_BOOL *pbFullScreen);
558 
559  // *** IWebBrowser2 methods ***
560  virtual HRESULT STDMETHODCALLTYPE Navigate2(VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName,
561  VARIANT *PostData, VARIANT *Headers);
562  virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf);
563  virtual HRESULT STDMETHODCALLTYPE ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
564  VARIANT *pvaIn, VARIANT *pvaOut);
565  virtual HRESULT STDMETHODCALLTYPE ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize);
566  virtual HRESULT STDMETHODCALLTYPE get_ReadyState(READYSTATE *plReadyState);
581 
582  // *** ITravelLogClient methods ***
584  virtual HRESULT STDMETHODCALLTYPE GetWindowData(IStream *pStream, LPWINDOWDATA pWinData);
585  virtual HRESULT STDMETHODCALLTYPE LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition);
586 
587  // *** IPersist methods ***
588  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
589 
590  // *** IPersistHistory methods ***
591  virtual HRESULT STDMETHODCALLTYPE LoadHistory(IStream *pStream, IBindCtx *pbc);
592  virtual HRESULT STDMETHODCALLTYPE SaveHistory(IStream *pStream);
593  virtual HRESULT STDMETHODCALLTYPE SetPositionCookie(DWORD dwPositioncookie);
594  virtual HRESULT STDMETHODCALLTYPE GetPositionCookie(DWORD *pdwPositioncookie);
595 
596  // message handlers
597  LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
598  LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
599  LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
601  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
604  LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
605  LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
606  LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
607  LRESULT OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
608  LRESULT OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
609  LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
610  LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
611  LRESULT OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
612  LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
613  LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
614  LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
615  LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
616  LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
617  LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
618  LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
619  LRESULT OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
620  LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
621  LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
622  LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
623  LRESULT OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
624  LRESULT OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
626  HRESULT OnSearch();
627 
629  {
630  static ATL::CWndClassInfo wc =
631  {
633  0, 0, NULL, LoadIcon(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_CABINET)),
635  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
636  };
637  return wc;
638  }
639 
676  END_MSG_MAP()
677 
679  CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
680  CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
682 
684  COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
685  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
687  COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
688  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
689  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
690  COM_INTERFACE_ENTRY_IID(IID_IProfferService, IProfferService)
691  COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
694  COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser)
695  COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowserApp)
696  COM_INTERFACE_ENTRY_IID(IID_IWebBrowser2, IWebBrowser2)
697  COM_INTERFACE_ENTRY_IID(IID_ITravelLogClient, ITravelLogClient)
699  COM_INTERFACE_ENTRY_IID(IID_IPersistHistory, IPersistHistory)
700  COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
701  COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
702  END_COM_MAP()
703 };
704 
705 extern HRESULT CreateProgressDialog(REFIID riid, void **ppv);
706 
708 {
711  fStatusBar = NULL;
712  fStatusBarVisible = true;
717 }
718 
720 {
721  if (menuDsa)
723 }
724 
726 {
727  CComPtr<IPersistStreamInit> persistStreamInit;
728  HRESULT hResult;
729  CComPtr<IUnknown> clientBar;
730 
732 
733  menuDsa = DSA_Create(sizeof(MenuBandInfo), 5);
734  if (!menuDsa)
735  return E_OUTOFMEMORY;
736 
739  {
740  }
741 
742  // create window
744  if (m_hWnd == NULL)
745  return E_FAIL;
746 
747  hResult = CInternetToolbar_CreateInstance(IID_PPV_ARG(IUnknown, &clientBar));
748  if (FAILED_UNEXPECTEDLY(hResult))
749  return hResult;
750 
752 
753  // create interfaces
754  hResult = clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
755  if (FAILED_UNEXPECTEDLY(hResult))
756  return hResult;
757 
758  hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
759  if (FAILED_UNEXPECTEDLY(hResult))
760  return hResult;
761 
762  hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
763  if (FAILED_UNEXPECTEDLY(hResult))
764  return hResult;
765 
766  // TODO: create settingsStream from registry entry
767  //if (settingsStream.p)
768  //{
769  // hResult = persistStreamInit->Load(settingsStream);
770  // if (FAILED_UNEXPECTEDLY(hResult))
771  // return hResult;
772  //}
773  //else
774  {
775  hResult = persistStreamInit->InitNew();
776  if (FAILED_UNEXPECTEDLY(hResult))
777  return hResult;
778  }
779 
780  hResult = IUnknown_ShowDW(clientBar, TRUE);
781  if (FAILED_UNEXPECTEDLY(hResult))
782  return hResult;
783 
784  fToolbarProxy.Initialize(m_hWnd, clientBar);
785 
786 
787  // create status bar
789  SBT_NOBORDERS | SBT_TOOLTIPS, 0, 0, 500, 20, m_hWnd, (HMENU)0xa001,
790  _AtlBaseModule.GetModuleInstance(), 0);
791  fStatusBarVisible = true;
792 
793 
795  UpdateWindow();
796 
797  return S_OK;
798 }
799 
801 {
802  CComPtr<IShellFolder> newFolder;
803  FOLDERSETTINGS newFolderSettings;
804  HRESULT hResult;
805 
806  // called by shell view to browse to new folder
807  // also called by explorer band to navigate to new folder
808  hResult = SHBindToFolder(pidl, &newFolder);
809  if (FAILED_UNEXPECTEDLY(hResult))
810  return hResult;
811 
812  newFolderSettings.ViewMode = FVM_ICON;
813  newFolderSettings.fFlags = 0;
814  hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
815  if (FAILED_UNEXPECTEDLY(hResult))
816  return hResult;
817  return S_OK;
818 }
819 
821 {
822  LPCITEMIDLIST pidlnext;
823  WORD length;
824  BOOL ret;
825 
826  ret = TRUE;
827  if (! _ILIsDesktop(pidl))
828  {
829  length = pidl->mkid.cb;
830  pidlnext =
831  reinterpret_cast<LPCITEMIDLIST>(
832  reinterpret_cast<const BYTE *>(pidl) + length);
833  if (pidlnext->mkid.cb != 0)
834  ret = FALSE;
835  }
836  return ret;
837 }
838 
840  const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
841 {
843  LPITEMIDLIST pidlChild;
844  LPITEMIDLIST pidlParent;
845  HRESULT hResult;
846 
847  hResult = E_FAIL;
848  if (ppv == NULL)
849  return E_POINTER;
850  *ppv = NULL;
851  if (ppidlLast != NULL)
852  *ppidlLast = NULL;
853  if (_ILIsPidlSimple(pidl))
854  {
855  if (ppidlLast != NULL)
856  *ppidlLast = ILClone(pidl);
857  hResult = SHGetDesktopFolder((IShellFolder **)ppv);
858  }
859  else
860  {
861  pidlChild = ILClone(ILFindLastID(pidl));
862  pidlParent = ILClone(pidl);
863  ILRemoveLastID(pidlParent);
864  hResult = SHGetDesktopFolder(&psf);
865  if (SUCCEEDED(hResult))
866  hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
867  if (SUCCEEDED(hResult) && ppidlLast != NULL)
868  *ppidlLast = pidlChild;
869  else
870  ILFree(pidlChild);
871  ILFree(pidlParent);
872  }
873  return hResult;
874 }
875 
876 HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10,
877  LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
878 {
879  CComPtr<IShellFolder> parentFolder;
880  LPITEMIDLIST childPIDL = NULL;
881  STRRET L108;
882  HRESULT hResult;
883 
884  hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
885  if (FAILED(hResult))
886  goto cleanup;
887 
888  hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
889  if (FAILED(hResult))
890  goto cleanup;
891 
892  StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
893  if (rgfInOut)
894  {
895  hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
896  if (FAILED(hResult))
897  goto cleanup;
898  }
899 
900  hResult = S_OK;
901 
902 cleanup:
903  if (childPIDL)
904  ILFree(childPIDL);
905  return hResult;
906 }
907 
908 long IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
909 {
910  return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
911 }
912 
914  LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
915 {
916  CComPtr<IObjectWithSite> objectWithSite;
917  CComPtr<IShellFolder> saveCurrentShellFolder;
918  CComPtr<IShellView> saveCurrentShellView;
919  CComPtr<IShellView> newShellView;
920  CComPtr<ITravelLog> travelLog;
921  HWND newShellViewWindow;
922  BOOL windowUpdateIsLocked;
923  RECT shellViewWindowBounds;
924  HWND previousView;
925  HCURSOR saveCursor;
926  wchar_t newTitle[MAX_PATH];
927  SHGDNF nameFlags;
928  HRESULT hResult;
929 
930  if (newShellFolder == NULL)
931  return E_INVALIDARG;
932 
933  hResult = GetTravelLog(&travelLog);
934  if (FAILED_UNEXPECTEDLY(hResult))
935  return hResult;
936 
937  // update history
939  {
940  if (travelLog->CountEntries(static_cast<IDropTarget *>(this)) > 0)
941  hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
942  // what to do with error? Do we want to halt browse because state save failed?
943  }
944 
945  if (fCurrentShellView)
946  {
947  fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
948  }
949 
950  // create view object
951  hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
952  if (FAILED_UNEXPECTEDLY(hResult))
953  return hResult;
954  previousView = fCurrentShellViewWindow;
955 
956  // enter updating section
957  saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
958  windowUpdateIsLocked = LockWindowUpdate(TRUE);
959  if (fCurrentShellView != NULL)
961 
962  // set site
963  hResult = IUnknown_SetSite(newShellView, static_cast<IDropTarget *>(this));
964 
965  // update folder and view
966  saveCurrentShellFolder = fCurrentShellFolder;
967  saveCurrentShellView = fCurrentShellView;
968  fCurrentShellFolder = newShellFolder;
969  fCurrentShellView = newShellView;
970 
971  // get boundary
972  if (previousView != NULL)
973  ::GetWindowRect(previousView, &shellViewWindowBounds);
974  else
975  ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
976  ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
977 
978  // create view window
979  hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
980  this, &shellViewWindowBounds, &newShellViewWindow);
981  if (FAILED_UNEXPECTEDLY(hResult) || newShellViewWindow == NULL)
982  {
983  fCurrentShellView = saveCurrentShellView;
984  fCurrentShellFolder = saveCurrentShellFolder;
986  if (windowUpdateIsLocked)
988  SetCursor(saveCursor);
989  return hResult;
990  }
991 
992  if (objectWithSite.p != NULL)
993  hResult = objectWithSite->SetSite(NULL);
994 
995  // update current pidl
997  fCurrentDirectoryPIDL = ILClone(absolutePIDL);
998 
999  // update view window
1000  if (saveCurrentShellView != NULL)
1001  saveCurrentShellView->DestroyViewWindow();
1002  fCurrentShellViewWindow = newShellViewWindow;
1003 
1004  if (previousView == NULL)
1005  {
1006  RepositionBars();
1007  }
1008 
1009  // no use
1010  saveCurrentShellView.Release();
1011  saveCurrentShellFolder.Release();
1012 
1013  hResult = newShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
1014 
1015  // leave updating section
1016  if (windowUpdateIsLocked)
1018  SetCursor(saveCursor);
1019 
1020  // update history
1022  {
1023  hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1024  hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1025  }
1026 
1027  // completed
1028  nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1029  hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1030  sizeof(newTitle) / sizeof(wchar_t), NULL);
1031  if (SUCCEEDED(hResult))
1032  {
1033  FireNavigateComplete(newTitle);
1034  }
1035  else
1036  {
1037  FireNavigateComplete(L"ERROR");
1038  }
1039 
1041  nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1042  else
1043  nameFlags = SHGDN_FORADDRESSBAR;
1044  hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1045  sizeof(newTitle) / sizeof(wchar_t), NULL);
1046  if (SUCCEEDED(hResult))
1047  {
1048  SetWindowText(newTitle);
1049 
1050  LPCITEMIDLIST pidlChild;
1051  INT index, indexOpen;
1052  HIMAGELIST himlSmall, himlLarge;
1053 
1055  hResult = SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1056  if (SUCCEEDED(hResult))
1057  {
1058  index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1059 
1060  Shell_GetImageLists(&himlLarge, &himlSmall);
1061 
1062  HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1063  HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1064 
1065  /* Hack to make it possible to release the old icons */
1066  /* Something seems to go wrong with WM_SETICON */
1067  HICON oldSmall = (HICON)SendMessage(WM_GETICON, ICON_SMALL, 0);
1068  HICON oldLarge = (HICON)SendMessage(WM_GETICON, ICON_BIG, 0);
1069 
1070  SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1071  SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge));
1072 
1073  DestroyIcon(oldSmall);
1074  DestroyIcon(oldLarge);
1075  }
1076  }
1077 
1079  hResult = UpdateForwardBackState();
1080  hResult = UpdateUpState();
1081  return S_OK;
1082 }
1083 
1085 {
1086  CComPtr<IBandSite> bandSite;
1087  CComPtr<IDeskBand> deskBand;
1088  HRESULT hResult;
1089 
1090  if (!fClientBars[BIInternetToolbar].clientBar)
1091  return E_FAIL;
1092 
1094  if (FAILED_UNEXPECTEDLY(hResult))
1095  return hResult;
1096 
1097  hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1098  if (FAILED_UNEXPECTEDLY(hResult))
1099  return hResult;
1100 
1101  return deskBand->QueryInterface(riid, shellMenu);
1102 }
1103 
1104 HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
1105 {
1106  CComPtr<IUnknown> newBaseBar;
1107  CComPtr<IDeskBar> deskBar;
1108  CComPtr<IUnknown> newBaseBarSite;
1109  CComPtr<IDeskBarClient> deskBarClient;
1110  IUnknown **cache;
1111  HRESULT hResult;
1112 
1113  if (vertical)
1115  else
1117  if (*cache == NULL)
1118  {
1119  hResult = CBaseBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBar), vertical);
1120  if (FAILED_UNEXPECTEDLY(hResult))
1121  return hResult;
1122  hResult = CBaseBarSite_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBarSite), vertical);
1123  if (FAILED_UNEXPECTEDLY(hResult))
1124  return hResult;
1125 
1126  // we have to store our basebar into cache now
1127  *cache = newBaseBar;
1128  newBaseBar->AddRef();
1129 
1130  // tell the new base bar about the shell browser
1131  hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
1132  if (FAILED_UNEXPECTEDLY(hResult))
1133  return hResult;
1134 
1135  // tell the new base bar about the new base bar site
1136  hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1137  if (FAILED_UNEXPECTEDLY(hResult))
1138  return hResult;
1139  hResult = deskBar->SetClient(newBaseBarSite);
1140  if (FAILED_UNEXPECTEDLY(hResult))
1141  return hResult;
1142 
1143  // tell the new base bar site about the new base bar
1144  hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1145  if (FAILED_UNEXPECTEDLY(hResult))
1146  return hResult;
1147  hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1148  if (FAILED_UNEXPECTEDLY(hResult))
1149  return hResult;
1150 
1151  }
1152  return (*cache)->QueryInterface(riid, theBaseBar);
1153 }
1154 
1155 BOOL CShellBrowser::IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID)
1156 {
1157  HRESULT hResult;
1158  CComPtr<IDeskBar> deskBar;
1159  CComPtr<IUnknown> baseBarSite;
1160  CComPtr<IBandSite> bandSite;
1161  CLSID clsidTmp;
1162  DWORD numBands;
1163  DWORD dwBandID;
1164  DWORD i;
1165 
1166  /* Get our basebarsite to be able to enumerate bands */
1167  hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1168  if (FAILED_UNEXPECTEDLY(hResult))
1169  return FALSE;
1170  hResult = deskBar->GetClient(&baseBarSite);
1171  if (FAILED_UNEXPECTEDLY(hResult))
1172  return FALSE;
1173  hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &bandSite));
1174  if (FAILED_UNEXPECTEDLY(hResult))
1175  return FALSE;
1176 
1177  hResult = bandSite->EnumBands(-1, &numBands);
1178  if (FAILED_UNEXPECTEDLY(hResult))
1179  return FALSE;
1180 
1181  for(i = 0; i < numBands; i++)
1182  {
1183  CComPtr<IPersist> bandPersist;
1184 
1185  hResult = bandSite->EnumBands(i, &dwBandID);
1186  if (FAILED_UNEXPECTEDLY(hResult))
1187  return FALSE;
1188 
1189  hResult = bandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &bandPersist));
1190  if (FAILED_UNEXPECTEDLY(hResult))
1191  return FALSE;
1192  hResult = bandPersist->GetClassID(&clsidTmp);
1193  if (FAILED_UNEXPECTEDLY(hResult))
1194  return FALSE;
1195  if (IsEqualGUID(clsidBand, clsidTmp))
1196  {
1197  if (pdwBandID) *pdwBandID = dwBandID;
1198  return TRUE;
1199  }
1200  }
1201  return FALSE;
1202 }
1203 
1204 HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1205 {
1206  CComPtr<IDockingWindow> dockingWindow;
1207  CComPtr<IUnknown> baseBarSite;
1208  CComPtr<IUnknown> newBand;
1209  CComPtr<IDeskBar> deskBar;
1210  VARIANT vaIn;
1211  HRESULT hResult;
1212  DWORD dwBandID;
1213 
1214  hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1215  if (FAILED_UNEXPECTEDLY(hResult))
1216  return hResult;
1217 
1218  hResult = deskBar->GetClient(&baseBarSite);
1219  if (FAILED_UNEXPECTEDLY(hResult))
1220  return hResult;
1221 
1222  hResult = deskBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1223  if (FAILED_UNEXPECTEDLY(hResult))
1224  return hResult;
1225 
1226  if (!IsBandLoaded(classID, vertical, &dwBandID))
1227  {
1228  TRACE("ShowBand called for CLSID %s, vertical=%d...\n", wine_dbgstr_guid(&classID), vertical);
1229  if (IsEqualCLSID(CLSID_ExplorerBand, classID))
1230  {
1231  TRACE("CLSID_ExplorerBand requested, building internal band.\n");
1232  hResult = CExplorerBand_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
1233  if (FAILED_UNEXPECTEDLY(hResult))
1234  return hResult;
1235  }
1236  else if (IsEqualCLSID(classID, CLSID_FileSearchBand))
1237  {
1238  TRACE("CLSID_FileSearchBand requested, building internal band.\n");
1239  hResult = CSearchBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
1240  if (FAILED_UNEXPECTEDLY(hResult))
1241  return hResult;
1242  }
1243  else
1244  {
1245  TRACE("A different CLSID requested, using CoCreateInstance.\n");
1246  hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1247  if (FAILED_UNEXPECTEDLY(hResult))
1248  return hResult;
1249  }
1250  }
1251  else
1252  {
1253  CComPtr<IBandSite> pBandSite;
1254 
1255  hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
1256  if (!SUCCEEDED(hResult))
1257  {
1258  ERR("Can't get IBandSite interface\n");
1259  return E_FAIL;
1260  }
1261  hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
1262  if (!SUCCEEDED(hResult))
1263  {
1264  ERR("Can't find band object\n");
1265  return E_FAIL;
1266  }
1267 
1268  // It's hackish, but we should be able to show the wanted band until we
1269  // find the proper way to do this (but it seems to work to add a new band)
1270  // Here we'll just re-add the existing band to the site, causing it to display.
1271  }
1272  V_VT(&vaIn) = VT_UNKNOWN;
1273  V_UNKNOWN(&vaIn) = newBand.p;
1274  hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
1275  if (FAILED_UNEXPECTEDLY(hResult))
1276  {
1277  return hResult;
1278  }
1279 
1280  hResult = dockingWindow->ShowDW(TRUE);
1281  if (FAILED_UNEXPECTEDLY(hResult))
1282  return hResult;
1283 
1284  if (vertical)
1285  {
1286  fCurrentVertBar = classID;
1288  }
1289 
1290  return S_OK;
1291 }
1292 
1294 {
1295  LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL);
1296  if (newDirectory == NULL)
1297  return E_OUTOFMEMORY;
1298  if (_ILIsDesktop(newDirectory))
1299  {
1300  ILFree(newDirectory);
1301  return E_INVALIDARG;
1302  }
1303  ILRemoveLastID(newDirectory);
1305  ILFree(newDirectory);
1306  if (FAILED_UNEXPECTEDLY(hResult))
1307  return hResult;
1308  return S_OK;
1309 }
1310 
1312 {
1313  PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1314  if (sheetInfo->nPages >= folderOptionsPageCountMax)
1315  return FALSE;
1316  sheetInfo->phpage[sheetInfo->nPages] = thePage;
1317  sheetInfo->nPages++;
1318  return TRUE;
1319 }
1320 
1322 {
1323  CComPtr<IShellPropSheetExt> folderOptionsSheet;
1324  PROPSHEETHEADER m_PropSheet;
1326 // CComPtr<IGlobalFolderSettings> globalSettings;
1327 // SHELLSTATE2 shellState;
1328  HRESULT hResult;
1329 
1330  memset(m_psp, 0, sizeof(m_psp));
1331  memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1332 
1333  // create sheet object
1334  hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1335  IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1336  if (FAILED_UNEXPECTEDLY(hResult))
1337  return E_FAIL;
1338 
1339  // must set site in order for Apply to all Folders on Advanced page to be enabled
1340  hResult = IUnknown_SetSite(folderOptionsSheet, static_cast<IDispatch *>(this));
1341  m_PropSheet.phpage = m_psp;
1342 
1343 #if 0
1344  hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1345  if (FAILED_UNEXPECTEDLY(hResult))
1346  return E_FAIL;
1347  hResult = globalSettings->Get(&shellState, sizeof(shellState));
1348  if (FAILED_UNEXPECTEDLY(hResult))
1349  return E_FAIL;
1350 #endif
1351 
1352  // add pages
1353  hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1354  if (FAILED_UNEXPECTEDLY(hResult))
1355  return E_FAIL;
1356 
1357 // CORE-11140 : Disabled this bit, because it prevents the folder options from showing.
1358 // It returns 'E_NOTIMPL'
1359 #if 0
1360  if (fCurrentShellView != NULL)
1361  {
1362  hResult = fCurrentShellView->AddPropertySheetPages(
1363  0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1364  if (FAILED_UNEXPECTEDLY(hResult))
1365  return E_FAIL;
1366  }
1367 #endif
1368 
1369  // show sheet
1370  CStringW strFolderOptions(MAKEINTRESOURCEW(IDS_FOLDER_OPTIONS));
1371  m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1372  m_PropSheet.dwFlags = 0;
1373  m_PropSheet.hwndParent = m_hWnd;
1374  m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1375  m_PropSheet.pszCaption = strFolderOptions;
1376  m_PropSheet.nStartPage = 0;
1377  PropertySheet(&m_PropSheet);
1378  return S_OK;
1379 }
1380 
1382 {
1383  CShellBrowser *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1384  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1385  LRESULT lResult;
1386  const _ATL_MSG *previousMessage;
1387  BOOL handled;
1388  WNDPROC saveWindowProc;
1389  HRESULT hResult;
1390 
1391  hWnd = pThis->m_hWnd;
1392  previousMessage = pThis->m_pCurrentMsg;
1393  pThis->m_pCurrentMsg = &msg;
1394 
1395  /* If the shell browser is initialized, let the menu band preprocess the messages */
1396  if (pThis->fCurrentDirectoryPIDL)
1397  {
1398  CComPtr<IMenuBand> menuBand;
1399  hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1400  if (SUCCEEDED(hResult) && menuBand.p != NULL)
1401  {
1402  hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1403  if (hResult == S_OK)
1404  return lResult;
1405  uMsg = msg.message;
1406  wParam = msg.wParam;
1407  lParam = msg.lParam;
1408  }
1409  menuBand.Release();
1410  }
1411 
1412  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1413  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1414  if (handled == FALSE)
1415  {
1416  if (uMsg == WM_NCDESTROY)
1417  {
1418  saveWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
1419  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1420  if (saveWindowProc == reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)))
1422  pThis->m_dwState |= WINSTATE_DESTROYED;
1423  }
1424  else
1425  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1426  }
1427  pThis->m_pCurrentMsg = previousMessage;
1428  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1429  {
1430  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1431  pThis->m_hWnd = NULL;
1432  pThis->OnFinalMessage(hWnd);
1433  }
1434  return lResult;
1435 }
1436 
1438 {
1439  RECT clientRect;
1440  RECT statusRect;
1441  int x;
1442 
1443  GetClientRect(&clientRect);
1444 
1446  {
1447  ::GetWindowRect(fStatusBar, &statusRect);
1448  ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1449  clientRect.right - clientRect.left,
1450  statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1451  clientRect.bottom -= statusRect.bottom - statusRect.top;
1452  }
1453 
1454  for (x = 0; x < 3; x++)
1455  {
1456  HWND hwnd = fClientBars[x].hwnd;
1457  RECT borderSpace = fClientBars[x].borderSpace;
1458  if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1459  {
1460  IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1461  fClientBars[x].hwnd = hwnd;
1462  }
1463  if (hwnd != NULL)
1464  {
1465  RECT toolbarRect = clientRect;
1466  if (borderSpace.top != 0)
1467  {
1468  toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1469  }
1470  else if (borderSpace.bottom != 0)
1471  {
1472  toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1473  }
1474  else if (borderSpace.left != 0)
1475  {
1476  toolbarRect.right = toolbarRect.left + borderSpace.left;
1477  }
1478  else if (borderSpace.right != 0)
1479  {
1480  toolbarRect.left = toolbarRect.right - borderSpace.right;
1481  }
1482 
1484  toolbarRect.left,
1485  toolbarRect.top,
1486  toolbarRect.right - toolbarRect.left,
1487  toolbarRect.bottom - toolbarRect.top,
1489 
1490  if (borderSpace.top != 0)
1491  {
1492  clientRect.top = toolbarRect.bottom;
1493  }
1494  else if (borderSpace.bottom != 0)
1495  {
1496  clientRect.bottom = toolbarRect.top;
1497  }
1498  else if (borderSpace.left != 0)
1499  {
1500  clientRect.left = toolbarRect.right;
1501  }
1502  else if (borderSpace.right != 0)
1503  {
1504  clientRect.right = toolbarRect.left;
1505  }
1506  }
1507  }
1508  ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1509  clientRect.right - clientRect.left,
1510  clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1511 }
1512 
1513 HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1514 {
1518  HRESULT hResult;
1519 
1520  params.rgvarg = arguments;
1521  params.rgdispidNamedArgs = NULL;
1522  params.cArgs = argCount;
1523  params.cNamedArgs = 0;
1524  IUnknown** pp = vec.begin();
1525  while (pp < vec.end())
1526  {
1527  if (*pp != NULL)
1528  {
1529  CComPtr<IDispatch> theDispatch;
1530 
1531  hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1532  hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1533  }
1534  pp++;
1535  }
1536  pp = vec2.begin();
1537  while (pp < vec2.end())
1538  {
1539  if (*pp != NULL)
1540  {
1541  CComPtr<IDispatch> theDispatch;
1542 
1543  hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1544  hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1545  }
1546  pp++;
1547  }
1548  return S_OK;
1549 }
1550 
1551 HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1552 {
1553  // these two variants intentionally to do use CComVariant because it would double free/release
1554  // or does not need to dispose at all
1555  VARIANT varArg[2];
1556  VARIANT varArgs;
1557  CComBSTR tempString(newDirectory);
1558 
1559  V_VT(&varArgs) = VT_BSTR;
1560  V_BSTR(&varArgs) = tempString.m_str;
1561 
1562  V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1563  V_VARIANTREF(&varArg[0]) = &varArgs;
1564  V_VT(&varArg[1]) = VT_DISPATCH;
1565  V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1566 
1567  return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1568 }
1569 
1570 HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1571 {
1572  VARIANT varArg[2];
1573 
1574  V_VT(&varArg[0]) = VT_BOOL;
1575  V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1576  V_VT(&varArg[1]) = VT_I4;
1577  V_I4(&varArg[1]) = commandID;
1578 
1579  return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1580 }
1581 
1583 {
1584  return FireCommandStateChange(false, -1);
1585 }
1586 
1588 {
1589  CComPtr<ITravelLog> travelLog;
1590  CComPtr<ITravelEntry> unusedEntry;
1591  bool canGoBack;
1592  bool canGoForward;
1593  HRESULT hResult;
1594 
1595  canGoBack = false;
1596  canGoForward = false;
1597  hResult = GetTravelLog(&travelLog);
1598  if (FAILED_UNEXPECTEDLY(hResult))
1599  return hResult;
1600  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1601  if (SUCCEEDED(hResult))
1602  {
1603  canGoBack = true;
1604  unusedEntry.Release();
1605  }
1606  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1607  if (SUCCEEDED(hResult))
1608  {
1609  canGoForward = true;
1610  unusedEntry.Release();
1611  }
1612  hResult = FireCommandStateChange(canGoBack, 2);
1613  hResult = FireCommandStateChange(canGoForward, 1);
1614  return S_OK;
1615 }
1616 
1618 {
1619  bool canGoUp;
1620  HRESULT hResult;
1621 
1622  canGoUp = true;
1624  canGoUp = false;
1625  hResult = FireCommandStateChange(canGoUp, 3);
1626  return S_OK;
1627 }
1628 
1630 {
1631  CComPtr<ITravelLog> travelLog;
1632  CComPtr<ITravelEntry> unusedEntry;
1633  int position;
1634  MENUITEMINFO menuItemInfo;
1635  HRESULT hResult;
1636 
1638 
1639  position = GetMenuItemCount(theMenu);
1640  hResult = GetTravelLog(&travelLog);
1641  if (FAILED_UNEXPECTEDLY(hResult))
1642  return;
1643 
1644  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1645  TLOG_BACK,
1646  &unusedEntry);
1647 
1648  if (SUCCEEDED(hResult))
1649  {
1650  SHEnableMenuItem(theMenu, IDM_GOTO_BACK, TRUE);
1651  unusedEntry.Release();
1652  }
1653  else
1655 
1656  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1657  TLOG_FORE,
1658  &unusedEntry);
1659 
1660  if (SUCCEEDED(hResult))
1661  {
1663  unusedEntry.Release();
1664  }
1665  else
1667 
1668  SHEnableMenuItem(theMenu,
1671 
1672  hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1674  if (SUCCEEDED(hResult))
1675  {
1676  menuItemInfo.cbSize = sizeof(menuItemInfo);
1677  menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1678  menuItemInfo.fType = MF_SEPARATOR;
1679  menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1680  InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1681  }
1682 }
1683 
1685 {
1686  CComPtr<ITravelLog> travelLog;
1687  HMENU gotoMenu;
1688  OLECMD commandList[5];
1689  HMENU toolbarMenuBar;
1690  HMENU toolbarMenu;
1691  MENUITEMINFO menuItemInfo;
1692  HRESULT hResult;
1693 
1694  gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1695  if (gotoMenu != NULL)
1696  UpdateGotoMenu(gotoMenu);
1697 
1698  commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1699  commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1700  commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1701  commandList[3].cmdID = ITID_TOOLBARLOCKED;
1702  commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1703 
1704  hResult = IUnknown_QueryStatus(fClientBars[BIInternetToolbar].clientBar,
1705  CGID_PrivCITCommands, 5, commandList, NULL);
1706  if (FAILED_UNEXPECTEDLY(hResult))
1708  else
1709  {
1710  menuItemInfo.cbSize = sizeof(menuItemInfo);
1711  menuItemInfo.fMask = MIIM_SUBMENU;
1712  GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1713  DestroyMenu(menuItemInfo.hSubMenu);
1714 
1715  toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1716  toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1717  RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION);
1718  DestroyMenu(toolbarMenuBar);
1719 
1720  // TODO: Implement
1721  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_ENABLED);
1722  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1723  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1724  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, commandList[4].cmdf & OLECMDF_ENABLED);
1725 
1726  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_LATCHED);
1727  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_LATCHED);
1728  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_LATCHED);
1729  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_LATCHED);
1730  if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1734 
1735  menuItemInfo.cbSize = sizeof(menuItemInfo);
1736  menuItemInfo.fMask = MIIM_SUBMENU;
1737  menuItemInfo.hSubMenu = toolbarMenu;
1738  SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1739  }
1741 }
1742 
1744 {
1745  HMENU hBandsMenu;
1746  UINT nbFound;
1747 
1749  if (!hBandsMenu)
1750  {
1751  OutputDebugString(L"No menu !\n");
1752  return E_FAIL;
1753  }
1755  BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
1756  BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
1757  if (!nbFound)
1758  {
1759  // Remove separator
1761  }
1762  // Remove media menu since XP does it (according to API Monitor)
1764  return S_OK;
1765 }
1766 
1768 {
1769  HRESULT hr;
1770  CComPtr<IEnumGUID> pEnumGUID;
1771  WCHAR wszBandName[MAX_PATH];
1772  WCHAR wszBandGUID[MAX_PATH];
1773  WCHAR wRegKey[MAX_PATH];
1774  UINT cBands;
1775  DWORD dwRead;
1776  DWORD dwDataSize;
1777  GUID iter;
1778  MenuBandInfo mbi;
1779 
1780  mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
1781  cBands = 0;
1782  hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
1783  if (FAILED_UNEXPECTEDLY(hr))
1784  {
1785  return hr;
1786  }
1787  do
1788  {
1789  pEnumGUID->Next(1, &iter, &dwRead);
1790  if (dwRead)
1791  {
1792  // Get the band name
1793  if (IsBuiltinBand(iter))
1794  continue;
1795  if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
1796  continue;
1797  StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
1798  dwDataSize = MAX_PATH;
1799  SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
1800 
1801  mbi.barGuid = iter;
1802  InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
1803  DSA_AppendItem(menuDsa, &mbi);
1804  cBands++;
1805  }
1806  }
1807  while (dwRead > 0);
1808  if (nbFound)
1809  *nbFound = cBands;
1810  return S_OK;
1811 }
1812 
1814 {
1815  if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
1816  return TRUE;
1817  if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
1818  return TRUE;
1819  if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
1820  return TRUE;
1821  if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
1822  return TRUE;
1823  if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
1824  return TRUE;
1825  if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
1826  return TRUE;
1827  return FALSE;
1828 }
1829 
1831 {
1832  CComPtr<IObjectWithSite> objectWithSite;
1833  CComPtr<IContextMenu> contextMenu;
1834  CMINVOKECOMMANDINFO commandInfo;
1835  const char *searchGUID = "{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
1836  HRESULT hResult;
1837 
1838  // TODO: Query shell if this command is enabled first
1839 
1840  memset(&commandInfo, 0, sizeof(commandInfo));
1841  commandInfo.cbSize = sizeof(commandInfo);
1842  commandInfo.hwnd = m_hWnd;
1843  commandInfo.lpParameters = searchGUID;
1844  commandInfo.nShow = SW_SHOWNORMAL;
1845 
1846  hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
1847  IID_PPV_ARG(IContextMenu, &contextMenu));
1848  if (FAILED_UNEXPECTEDLY(hResult))
1849  return 0;
1850  hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1851  if (FAILED_UNEXPECTEDLY(hResult))
1852  return 0;
1853  hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
1854  if (FAILED_UNEXPECTEDLY(hResult))
1855  return 0;
1856  hResult = contextMenu->InvokeCommand(&commandInfo);
1857  hResult = objectWithSite->SetSite(NULL);
1858  return hResult;
1859 }
1860 
1862 {
1863  CComPtr<IUnknown> int1Retry;
1864  CComPtr<IUnknown> int2Retry;
1865  HRESULT hResult;
1866 
1867  if (int1 == int2)
1868  return true;
1869  if (int1 == NULL || int2 == NULL)
1870  return false;
1871  hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1872  if (FAILED_UNEXPECTEDLY(hResult))
1873  return false;
1874  hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1875  if (FAILED_UNEXPECTEDLY(hResult))
1876  return false;
1877  if (int1Retry == int2Retry)
1878  return true;
1879  return false;
1880 }
1881 
1883 {
1884  static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
1885 
1886  RECT availableBounds;
1887 
1888  GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1889  for (INT x = 0; x < 3; x++)
1890  {
1891  if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1892  {
1893  availableBounds.top += fClientBars[x].borderSpace.top;
1894  availableBounds.left += fClientBars[x].borderSpace.left;
1895  availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1896  availableBounds.right -= fClientBars[x].borderSpace.right;
1897  }
1898  }
1899  *prcBorder = availableBounds;
1900  return S_OK;
1901 }
1902 
1904 {
1905  return S_OK;
1906 }
1907 
1909 {
1910  for (INT x = 0; x < 3; x++)
1911  {
1912  if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1913  {
1914  fClientBars[x].borderSpace = *pbw;
1915  // if this bar changed size, it cascades and forces all subsequent bars to resize
1916  RepositionBars();
1917  return S_OK;
1918  }
1919  }
1920  return E_INVALIDARG;
1921 }
1922 
1924  ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
1925 {
1926  CComPtr<IOleCommandTarget> commandTarget;
1927  HRESULT hResult;
1928 
1929  if (prgCmds == NULL)
1930  return E_INVALIDARG;
1931  if (pguidCmdGroup == NULL)
1932  {
1933  if (fCurrentShellView.p != NULL)
1934  {
1935  hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
1936  if (SUCCEEDED(hResult) && commandTarget.p != NULL)
1937  return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
1938  }
1939  while (cCmds != 0)
1940  {
1941  prgCmds->cmdf = 0;
1942  prgCmds++;
1943  cCmds--;
1944  }
1945  }
1946  else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1947  {
1948  while (cCmds != 0)
1949  {
1950  switch (prgCmds->cmdID)
1951  {
1952  case 0x1c: // search
1953  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1954  if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
1955  IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
1956  IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
1957  IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
1958  {
1959  prgCmds->cmdf |= OLECMDF_LATCHED;
1960  }
1961  break;
1962  case 0x1d: // history
1963  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1964  if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
1965  prgCmds->cmdf |= OLECMDF_LATCHED;
1966  break;
1967  case 0x1e: // favorites
1968  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1969  if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
1970  prgCmds->cmdf |= OLECMDF_LATCHED;
1971  break;
1972  case 0x23: // folders
1973  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1974  if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
1975  prgCmds->cmdf |= OLECMDF_LATCHED;
1976  break;
1977  default:
1978  prgCmds->cmdf = 0;
1979  break;
1980  }
1981  prgCmds++;
1982  cCmds--;
1983  }
1984  }
1985  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1986  {
1987  while (cCmds != 0)
1988  {
1989  switch (prgCmds->cmdID)
1990  {
1991  case 0xa022: // up level
1992  prgCmds->cmdf = OLECMDF_SUPPORTED;
1993  if (fCurrentDirectoryPIDL->mkid.cb != 0)
1994  prgCmds->cmdf |= OLECMDF_ENABLED;
1995  break;
1996  }
1997  prgCmds++;
1998  cCmds--;
1999  }
2000  }
2001  return S_OK;
2002 }
2003 
2005  DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2006 {
2007  HRESULT hResult;
2008 
2009  if (!pguidCmdGroup)
2010  {
2011  TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
2012  return E_NOTIMPL;
2013  }
2014  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2015  {
2016  switch (nCmdID)
2017  {
2018  case 0x1c: //Toggle Search
2019  case 0x1d: //Toggle History
2020  case 0x1e: //Toggle Favorites
2021  case 0x23: //Toggle Folders
2022  const GUID* pclsid;
2023  if (nCmdID == 0x1c) pclsid = &CLSID_FileSearchBand;
2024  else if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
2025  else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
2026  else pclsid = &CLSID_ExplorerBand;
2027 
2028  if (IsEqualCLSID(*pclsid, fCurrentVertBar))
2029  {
2030  hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2031  memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2033  }
2034  else
2035  {
2036  hResult = ShowBand(*pclsid, true);
2037  }
2038  return S_OK;
2039  case 0x22:
2040  //Sent when a band closes
2041  if (V_VT(pvaIn) != VT_UNKNOWN)
2042  return E_INVALIDARG;
2043 
2044  if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
2045  {
2046  memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2048  }
2049  return S_OK;
2050  case 0x27:
2051  if (nCmdexecopt == 1)
2052  {
2053  // pvaIn is a VT_UNKNOWN with a band that is being hidden
2054  }
2055  else
2056  {
2057  // update zones part of the status bar
2058  }
2059  return S_OK;
2060  case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
2061  V_VT(pvaOut) = VT_INT_PTR;
2062  V_INTREF(pvaOut) = reinterpret_cast<INT *>(
2063  LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
2064  return S_OK;
2065  case 0x38:
2066  // indicate if this cabinet was opened as a browser
2067  return S_FALSE;
2068  default:
2069  return E_NOTIMPL;
2070  }
2071  }
2072  else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
2073  {
2074  switch (nCmdID)
2075  {
2076  case 0x23:
2077  // placeholder
2078  return S_OK;
2079  }
2080  }
2081  else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
2082  {
2083  switch (nCmdID)
2084  {
2085  case 6:
2086  // what is theater mode and why do we receive this?
2087  return E_NOTIMPL;
2088  }
2089  }
2090  else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
2091  {
2092  switch (nCmdID)
2093  {
2094  case 14:
2095  // initialize favorites menu
2096  return S_OK;
2097  }
2098  }
2099  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
2100  {
2101  switch (nCmdID)
2102  {
2103  case 0x12:
2104  // refresh on toolbar clicked
2105  return S_OK;
2106  case 0x26:
2107  // called for unknown bands ?
2108  return S_OK;
2109  case 0x4d:
2110  // tell the view if it should hide the task pane or not
2111  return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
2112  }
2113  }
2114  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2115  {
2116  switch (nCmdID)
2117  {
2118  case 40994:
2119  return NavigateToParent();
2120  }
2121  }
2122  else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
2123  {
2124  switch (nCmdID)
2125  {
2126  case 0x7063:
2127  return DoFolderOptions();
2128  }
2129  }
2130  else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
2131  {
2132  switch (nCmdID)
2133  {
2134  case 1:
2135  // Reset All Folders option in Folder Options
2136  break;
2137  }
2138  }
2139  else
2140  {
2141  return E_NOTIMPL;
2142  }
2143  return E_NOTIMPL;
2144 }
2145 
2147 {
2148  if (lphwnd == NULL)
2149  return E_POINTER;
2150  *lphwnd = m_hWnd;
2151  return S_OK;
2152 }
2153 
2155 {
2156  return E_NOTIMPL;
2157 }
2158 
2159 HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
2160 {
2161  HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2162 
2163  Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
2164 
2165  int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
2166  Unused(itemCount3);
2167 
2168  DestroyMenu(mainMenu);
2169 
2170  lpMenuWidths->width[0] = 2;
2171  lpMenuWidths->width[2] = 3;
2172  lpMenuWidths->width[4] = 1;
2173  return S_OK;
2174 }
2175 
2176 HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
2177 {
2178  CComPtr<IShellMenu> shellMenu;
2179  HRESULT hResult;
2180 
2181  if (hmenuShared && IsMenu(hmenuShared) == FALSE)
2182  return E_FAIL;
2183  hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
2184  if (FAILED_UNEXPECTEDLY(hResult))
2185  return hResult;
2186 
2187  if (!hmenuShared)
2188  {
2189  hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2190  }
2191  // FIXME: Figure out the proper way to do this.
2192  HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
2193  if (hMenuFavs)
2194  {
2196  }
2197 
2198  hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
2199  if (FAILED_UNEXPECTEDLY(hResult))
2200  return hResult;
2201  fCurrentMenuBar = hmenuShared;
2203  return S_OK;
2204 }
2205 
2207 {
2208  if (hmenuShared == fCurrentMenuBar)
2209  {
2210  //DestroyMenu(fCurrentMenuBar);
2211  SetMenuSB(NULL, NULL, NULL);
2212  }
2213  return S_OK;
2214 }
2215 
2217 {
2218  //
2219  if (pszStatusText)
2220  {
2221  ::SetWindowText(fStatusBar, pszStatusText);
2222  }
2223  else
2224  {
2225 
2226  }
2227  return S_OK;
2228 }
2229 
2231 {
2232  return E_NOTIMPL;
2233 }
2234 
2236 {
2237  if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
2238  return S_FALSE;
2239  return S_OK;
2240 }
2241 
2243 {
2244  if ((wFlags & SBSP_EXPLOREMODE) != NULL)
2245  ShowBand(CLSID_ExplorerBand, true);
2246 
2248  if (fTravelLog)
2250  return BrowseToPIDL(pidl, flags);
2251 }
2252 
2254 {
2255  return E_NOTIMPL;
2256 }
2257 
2259 {
2260  if (lphwnd == NULL)
2261  return E_POINTER;
2262  *lphwnd = NULL;
2263  switch (id)
2264  {
2265  case FCW_TOOLBAR:
2266  *lphwnd = fToolbarProxy.m_hWnd;
2267  return S_OK;
2268  case FCW_STATUS:
2269  *lphwnd = fStatusBar;
2270  return S_OK;
2271  case FCW_TREE:
2272  // find the directory browser and return it
2273  // this should be used only to determine if a tree is present
2274  return S_OK;
2275  case FCW_PROGRESS:
2276  // is this a progress dialog?
2277  return S_OK;
2278  }
2279  return S_OK;
2280 }
2281 
2283  UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
2284 {
2285  LPARAM result;
2286 
2287  if (pret != NULL)
2288  *pret = 0;
2289  switch (id)
2290  {
2291  case FCW_TOOLBAR:
2293  if (pret != NULL)
2294  *pret = result;
2295  break;
2296  case FCW_STATUS:
2298  if (pret != NULL)
2299  *pret = result;
2300  break;
2301  }
2302  return S_OK;
2303 }
2304 
2306 {
2307  if (ppshv == NULL)
2308  return E_POINTER;
2309  *ppshv = fCurrentShellView;
2310  if (fCurrentShellView.p != NULL)
2312  return S_OK;
2313 }
2314 
2316 {
2317  return E_NOTIMPL;
2318 }
2319 
2321 {
2322  return E_NOTIMPL;
2323 }
2324 
2326  IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2327 {
2328  return E_NOTIMPL;
2329 }
2330 
2332 {
2333  return E_NOTIMPL;
2334 }
2335 
2337 {
2338  return E_NOTIMPL;
2339 }
2340 
2342  IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2343 {
2344  return E_NOTIMPL;
2345 }
2346 
2348 {
2349  // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2350  // the returned interface has a method GetPropertyBag on it
2351  if (IsEqualIID(guidService, SID_STopLevelBrowser))
2352  return this->QueryInterface(riid, ppvObject);
2353  if (IsEqualIID(guidService, SID_SShellBrowser))
2354  return this->QueryInterface(riid, ppvObject);
2355  if (IsEqualIID(guidService, SID_ITargetFrame2))
2356  return this->QueryInterface(riid, ppvObject);
2357  if (IsEqualIID(guidService, SID_IWebBrowserApp)) // without this, the internet toolbar won't reflect notifications
2358  return this->QueryInterface(riid, ppvObject);
2359  if (IsEqualIID(guidService, SID_SProxyBrowser))
2360  return this->QueryInterface(riid, ppvObject);
2361  if (IsEqualIID(guidService, SID_IExplorerToolbar))
2362  return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2363  if (IsEqualIID(riid, IID_IShellBrowser))
2364  return this->QueryInterface(riid, ppvObject);
2365  return E_NOINTERFACE;
2366 }
2367 
2369 {
2370  if (ppvObject == NULL)
2371  return E_POINTER;
2372  *ppvObject = NULL;
2373  return E_NOTIMPL;
2374 }
2375 
2377 {
2378  return E_NOTIMPL;
2379 }
2380 
2382 {
2383  return E_NOTIMPL;
2384 }
2385 
2387  UINT cNames, LCID lcid, DISPID *rgDispId)
2388 {
2389  return E_NOTIMPL;
2390 }
2391 
2393  WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2394 {
2395  return E_NOTIMPL;
2396 }
2397 
2399 {
2400  return E_NOTIMPL;
2401 }
2402 
2404 {
2405  return E_NOTIMPL;
2406 }
2407 
2409 {
2410  return E_NOTIMPL;
2411 }
2412 
2414 {
2415  return E_NOTIMPL;
2416 }
2417 
2419 {
2420  HRESULT hResult;
2421 
2422  // called by toolbar when displaying tooltips
2423  if (pptl == NULL)
2424  return E_FAIL;
2425 
2426  *pptl = NULL;
2427  if (fTravelLog.p == NULL)
2428  {
2430  if (FAILED_UNEXPECTEDLY(hResult))
2431  return hResult;
2432  }
2433  *pptl = fTravelLog.p;
2434  fTravelLog.p->AddRef();
2435  return S_OK;
2436 }
2437 
2439 {
2440  return E_NOTIMPL;
2441 }
2442 
2444 {
2445  return E_NOTIMPL;
2446 }
2447 
2449 {
2450  return E_NOTIMPL;
2451 }
2452 
2454 {
2455  return E_NOTIMPL;
2456 }
2457 
2459 {
2460  return E_NOTIMPL;
2461 }
2462 
2464 {
2465  return E_NOTIMPL;
2466 }
2467 
2469 {
2470  return E_NOTIMPL;
2471 }
2472 
2474 {
2475  return E_NOTIMPL;
2476 }
2477 
2479 {
2480  return E_NOTIMPL;
2481 }
2482 
2484 {
2485  return E_NOTIMPL;
2486 }
2487 
2489 {
2490  return E_NOTIMPL;
2491 }
2492 
2494 {
2495  return E_NOTIMPL;
2496 }
2497 
2499 {
2500  return E_NOTIMPL;
2501 }
2502 
2504 {
2505  return E_NOTIMPL;
2506 }
2507 
2509 {
2510  // called by explorer bar to get current pidl
2511  if (ppidl == NULL)
2512  return E_POINTER;
2513  *ppidl = ILClone(fCurrentDirectoryPIDL);
2514  return S_OK;
2515 }
2516 
2518 {
2519  return E_NOTIMPL;
2520 }
2521 
2523 {
2524  return -1;
2525 }
2526 
2528 {
2529  return E_NOTIMPL;
2530 }
2531 
2533 {
2534  if (ppole == NULL || pstm == NULL || ppbc == NULL)
2535  return E_INVALIDARG;
2536  *ppole = fHistoryObject;
2537  if (fHistoryObject != NULL)
2539  *pstm = fHistoryStream;
2540  if (fHistoryStream != NULL)
2542  *ppbc = fHistoryBindContext;
2543  if (fHistoryBindContext != NULL)
2545  fHistoryObject = NULL;
2546  fHistoryStream = NULL;
2548  if (*ppole == NULL)
2549  return E_FAIL;
2550  return S_OK;
2551 }
2552 
2554 {
2555  return E_NOTIMPL;
2556 }
2557 
2559 {
2560  return E_NOTIMPL;
2561 }
2562 
2564 {
2565  return E_NOTIMPL;
2566 }
2567 
2569  IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2570 {
2571  return E_NOTIMPL;
2572 }
2573 
2575 {
2576  return E_NOTIMPL;
2577 }
2578 
2580 {
2581  return E_NOTIMPL;
2582 }
2583 
2585 {
2586  return E_NOTIMPL;
2587 }
2588 
2590 {
2591  return E_NOTIMPL;
2592 }
2593 
2595 {
2596  return E_NOTIMPL;
2597 }
2598 
2600 {
2601  return E_NOTIMPL;
2602 }
2603 
2605 {
2607  return S_OK;
2608 }
2609 
2611 {
2612  return 0;
2613 }
2614 
2616 {
2617  return E_NOTIMPL;
2618 }
2619 
2621 {
2622  return 0;
2623 }
2624 
2626 {
2627  return E_NOTIMPL;
2628 }
2629 
2631 {
2632  return E_NOTIMPL;
2633 }
2634 
2636 {
2637  return E_NOTIMPL;
2638 }
2639 
2641 {
2642  return E_NOTIMPL;
2643 }
2644 
2646  IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2647 {
2648  return E_NOTIMPL;
2649 }
2650 
2652 {
2653  return E_NOTIMPL;
2654 }
2655 
2657 {
2658  return E_NOTIMPL;
2659 }
2660 
2662 {
2663  return E_NOTIMPL;
2664 }
2665 
2667 {
2668  return NULL;
2669 }
2670 
2672 {
2673  return E_NOTIMPL;
2674 }
2675 
2677 {
2678  return E_NOTIMPL;
2679 }
2680 
2682 {
2683  return E_NOTIMPL;
2684 }
2685 
2687 {
2688  return E_NOTIMPL;
2689 }
2690 
2692 {
2693  return E_NOTIMPL;
2694 }
2695 
2697 {
2698  return E_NOTIMPL;
2699 }
2700 
2702 {
2703  return E_NOTIMPL;
2704 }
2705 
2707 {
2708  return E_NOTIMPL;
2709 }
2710 
2712 {
2713  return E_NOTIMPL;
2714 }
2715 
2717 {
2718  return E_NOTIMPL;
2719 }
2720 
2722 {
2723  return E_NOTIMPL;
2724 }
2725 
2727 {
2728  return E_NOTIMPL;
2729 }
2730 
2732 {
2733  return E_NOTIMPL;
2734 }
2735 
2737 {
2738  return E_NOTIMPL;
2739 }
2740 
2742 {
2743  return E_NOTIMPL;
2744 }
2745 
2747 {
2748  return E_NOTIMPL;
2749 }
2750 
2752 {
2753  return E_NOTIMPL;
2754 }
2755 
2757  const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2758 {
2759  return E_NOTIMPL;
2760 }
2761 
2763  HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2764 {
2765  return E_NOTIMPL;
2766 }
2767 
2769 {
2770  return E_NOTIMPL;
2771 }
2772 
2774 {
2775  return E_NOTIMPL;
2776 }
2777 
2779 {
2780  return E_NOTIMPL;
2781 }
2782 
2784 {
2785  return 0;
2786 }
2787 
2789 {
2790  return E_NOTIMPL;
2791 }
2792 
2794 {
2795  return E_NOTIMPL;
2796 }
2797 
2799 {
2800  return E_NOTIMPL;
2801 }
2802 
2804 {
2805  return E_NOTIMPL;
2806 }
2807 
2809 {
2810  return E_NOTIMPL;
2811 }
2812 
2814 {
2815  return E_NOTIMPL;
2816 }
2817 
2819 {
2820  return E_NOTIMPL;
2821 }
2822 
2824 {
2825  return NULL;
2826 }
2827 
2829 {
2830  return 0;
2831 }
2832 
2834 {
2835  return E_NOTIMPL;
2836 }
2837 
2839 {
2840  return 0;
2841 }
2842 
2844 {
2845  return NULL;
2846 }
2847 
2849 {
2850  return E_NOTIMPL;
2851 }
2852 
2854 {
2855  return E_NOTIMPL;
2856 }
2857 
2859 {
2860  return E_NOTIMPL;
2861 }
2862 
2864  LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
2865 {
2866  return E_NOTIMPL;
2867 }
2868 
2870 {
2871  return E_NOTIMPL;
2872 }
2873 
2875 {
2876  return 0;
2877 }
2878 
2880 {
2881  return E_NOTIMPL;
2882 }
2883 
2885 {
2886  for (int i = 0; i < 3; i++)
2887  {
2888  if (IUnknown_TranslateAcceleratorIO(fClientBars[i].clientBar, pmsg) == S_OK)
2889  return S_OK;
2890  }
2891 
2892  if (!fCurrentShellView)
2893  return S_FALSE;
2894 
2895  return fCurrentShellView->TranslateAcceleratorW(pmsg);
2896 }
2897 
2899 {
2900  return E_NOTIMPL;
2901 }
2902 
2904 {
2905  return E_NOTIMPL;
2906 }
2907 
2909 {
2910  CComPtr<ITravelLog> travelLog;
2911  HRESULT hResult = GetTravelLog(&travelLog);
2912  if (FAILED_UNEXPECTEDLY(hResult))
2913  return hResult;
2914  return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
2915 }
2916 
2918 {
2919  CComPtr<ITravelLog> travelLog;
2920  HRESULT hResult = GetTravelLog(&travelLog);
2921  if (FAILED_UNEXPECTEDLY(hResult))
2922  return hResult;
2923  return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
2924 }
2925 
2927 {
2928  return E_NOTIMPL;
2929 }
2930 
2932 {
2933  return E_NOTIMPL;
2934 }
2935 
2937  VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2938 {
2940  HRESULT hResult;
2941  CComPtr<IShellFolder> pDesktop;
2942 
2943  hResult = SHGetDesktopFolder(&pDesktop);
2944  if (FAILED_UNEXPECTEDLY(hResult))
2945  return hResult;
2946  hResult = pDesktop->ParseDisplayName(NULL, NULL, URL, NULL, &pidl, NULL);
2947  if (FAILED_UNEXPECTEDLY(hResult))
2948  return hResult;
2949  return BrowseObject(pidl, 1);
2950 }
2951 
2953 {
2954  VARIANT level;
2955 
2956  V_VT(&level) = VT_I4;
2957  V_I4(&level) = 4;
2958  return Refresh2(&level);
2959 }
2960 
2962 {
2963  CComPtr<IOleCommandTarget> oleCommandTarget;
2964  HRESULT hResult;
2965 
2966  hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
2967  if (FAILED_UNEXPECTEDLY(hResult))
2968  return hResult;
2969  return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
2970 }
2971 
2973 {
2974  return E_NOTIMPL;
2975 }
2976 
2978 {
2979  return E_NOTIMPL;
2980 }
2981 
2983 {
2984  return E_NOTIMPL;
2985 }
2986 
2988 {
2989  return E_NOTIMPL;
2990 }
2991 
2993 {
2994  return E_NOTIMPL;
2995 }
2996 
2998 {
2999  return E_NOTIMPL;
3000 }
3001 
3003 {
3004  return E_NOTIMPL;
3005 }
3006 #ifdef __exdisp_h__
3007 #define long LONG
3008 #endif
3010 {
3011  return E_NOTIMPL;
3012 }
3013 
3015 {
3016  return E_NOTIMPL;
3017 }
3018 
3020 {
3021  return E_NOTIMPL;
3022 }
3023 
3025 {
3026  return E_NOTIMPL;
3027 }
3028 
3030 {
3031  return E_NOTIMPL;
3032 }
3033 
3035 {
3036  return E_NOTIMPL;
3037 }
3038 
3040 {
3041  return E_NOTIMPL;
3042 }
3043 
3045 {
3046  return E_NOTIMPL;
3047 }
3048 #ifdef __exdisp_h__
3049 #undef long
3050 #endif
3052 {
3053  return E_NOTIMPL;
3054 }
3055 
3057 {
3058  return E_NOTIMPL;
3059 }
3060 
3062 {
3063  return E_NOTIMPL;
3064 }
3065 
3067 {
3068  return E_NOTIMPL;
3069 }
3070 
3072 {
3073  return E_NOTIMPL;
3074 }
3075 
3077 {
3078  return E_NOTIMPL;
3079 }
3080 
3082 {
3083  return E_NOTIMPL;
3084 }
3085 
3087 {
3088  return E_NOTIMPL;
3089 }
3090 
3092 {
3093  return E_NOTIMPL;
3094 }
3095 
3097 {
3098  return E_NOTIMPL;
3099 }
3100 
3102 {
3103  return E_NOTIMPL;
3104 }
3105 
3107 {
3108  return E_NOTIMPL;
3109 }
3110 
3112 {
3113  return E_NOTIMPL;
3114 }
3115 
3117 {
3118  return E_NOTIMPL;
3119 }
3120 
3122 {
3123  return E_NOTIMPL;
3124 }
3125 
3127 {
3128  return E_NOTIMPL;
3129 }
3130 
3132 {
3133  return E_NOTIMPL;
3134 }
3135 
3137 {
3138  return E_NOTIMPL;
3139 }
3140 
3142 {
3143  return E_NOTIMPL;
3144 }
3145 
3147 {
3148  return E_NOTIMPL;
3149 }
3150 
3152 {
3153  return E_NOTIMPL;
3154 }
3155 
3157 {
3158  return E_NOTIMPL;
3159 }
3160 
3162 {
3163  return E_NOTIMPL;
3164 }
3165 
3167  VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3168 {
3169  LPITEMIDLIST pidl = NULL;
3170  HRESULT hResult;
3171  // called from drive combo box to navigate to a directory
3172  // Also called by search band to display shell results folder view
3173 
3174  if (V_VT(URL) == VT_BSTR)
3175  {
3176  return this->Navigate(V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
3177  }
3178  if (V_VT(URL) == (VT_ARRAY | VT_UI1))
3179  {
3180  if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
3181  return E_INVALIDARG;
3182 
3183  pidl = static_cast<LPITEMIDLIST>(V_ARRAY(URL)->pvData);
3184  }
3186  if (FAILED_UNEXPECTEDLY(hResult))
3187  return hResult;
3188  return S_OK;
3189 }
3190 
3192 {
3193  return E_NOTIMPL;
3194 }
3195 
3197  VARIANT *pvaIn, VARIANT *pvaOut)
3198 {
3199  return E_NOTIMPL;
3200 }
3201 
3203 {
3204  CLSID classID;
3205  bool vertical;
3206 
3207  // called to show search bar
3208  if (V_VT(pvaClsid) != VT_BSTR)
3209  return E_INVALIDARG;
3210  CLSIDFromString(V_BSTR(pvaClsid), &classID);
3211  // TODO: properly compute the value of vertical
3212  vertical = true;
3213  return ShowBand(classID, vertical);
3214 }
3215 
3217 {
3218  return E_NOTIMPL;
3219 }
3220 
3222 {
3223  return E_NOTIMPL;
3224 }
3225 
3227 {
3228  return E_NOTIMPL;
3229 }
3230 
3232 {
3233  return E_NOTIMPL;
3234 }
3235 
3237 {
3238  return E_NOTIMPL;
3239 }
3240 
3242 {
3243  return E_NOTIMPL;
3244 }
3245 
3247 {
3248  return E_NOTIMPL;
3249 }
3250 
3252 {
3253  return E_NOTIMPL;
3254 }
3255 
3257 {
3258  return E_NOTIMPL;
3259 }
3260 
3262 {
3263  return E_NOTIMPL;
3264 }
3265 
3267 {
3268  return E_NOTIMPL;
3269 }
3270 
3272 {
3273  return E_NOTIMPL;
3274 }
3275 
3277 {
3278  return E_NOTIMPL;
3279 }
3280 
3282 {
3283  return E_NOTIMPL;
3284 }
3285 
3287 {
3288  return E_NOTIMPL;
3289 }
3290 
3292 {
3293  return E_NOTIMPL;
3294 }
3295 
3297 {
3298  if (pWinData == NULL)
3299  return E_POINTER;
3300 
3301  pWinData->dwWindowID = -1;
3302  pWinData->uiCP = 0;
3303  pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
3304  pWinData->lpszUrl = NULL;
3305  pWinData->lpszUrlLocation = NULL;
3306  pWinData->lpszTitle = NULL;
3307  return S_OK;
3308 }
3309 
3311 {
3312  return E_NOTIMPL;
3313 }
3314 
3316 {
3317  return E_NOTIMPL;
3318 }
3319 
3321 {
3322  CComPtr<IPersistHistory> viewPersistHistory;
3323  CComPtr<IOleObject> viewHistoryObject;
3324  persistState oldState;
3325  ULONG numRead;
3326  LPITEMIDLIST pidl;
3327  HRESULT hResult;
3328 
3329  hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
3330  if (FAILED_UNEXPECTEDLY(hResult))
3331  return hResult;
3332  if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
3333  return E_FAIL;
3334  if (oldState.browseType != 2)
3335  return E_FAIL;
3336  pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
3337  if (pidl == NULL)
3338  return E_OUTOFMEMORY;
3339  hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
3340  if (FAILED_UNEXPECTEDLY(hResult))
3341  {
3342  ILFree(pidl);
3343  return hResult;
3344  }
3345  if (numRead != oldState.pidlSize)
3346  {
3347  ILFree(pidl);
3348  return E_FAIL;
3349  }
3350  hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
3351  IID_PPV_ARG(IOleObject, &viewHistoryObject));
3352  fHistoryObject = viewHistoryObject;
3353  fHistoryStream = pStream;
3354  fHistoryBindContext = pbc;
3355  hResult = BrowseToPIDL(pidl, BTP_DONT_UPDATE_HISTORY);
3356  fHistoryObject = NULL;
3357  fHistoryStream = NULL;
3359  ILFree(pidl);
3360  if (FAILED_UNEXPECTEDLY(hResult))
3361  return hResult;
3362  return S_OK;
3363 }
3364 
3366 {
3367  CComPtr<IPersistHistory> viewPersistHistory;
3368  persistState newState;
3369  HRESULT hResult;
3370 
3371  hResult = fCurrentShellView->GetItemObject(
3372  SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3373  memset(&newState, 0, sizeof(newState));
3374  newState.dwSize = sizeof(newState);
3375  newState.browseType = 2;
3376  newState.browserIndex = GetBrowserIndex();
3377  if (viewPersistHistory.p != NULL)
3378  {
3379  hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3380  if (FAILED_UNEXPECTEDLY(hResult))
3381  return hResult;
3382  }
3384  hResult = pStream->Write(&newState, sizeof(newState), NULL);
3385  if (FAILED_UNEXPECTEDLY(hResult))
3386  return hResult;
3387  hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3388  if (FAILED_UNEXPECTEDLY(hResult))
3389  return hResult;
3390  if (viewPersistHistory.p != NULL)
3391  {
3392  hResult = viewPersistHistory->SaveHistory(pStream);
3393  if (FAILED_UNEXPECTEDLY(hResult))
3394  return hResult;
3395  }
3396  return S_OK;
3397 }
3398 
3400 {
3401  return E_NOTIMPL;
3402 }
3403 
3405 {
3406  return E_NOTIMPL;
3407 }
3408 
3410 {
3411  OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3412  return 0;
3413 }
3414 
3416 {
3417  HRESULT hr;
3418 
3419  /* The current thread is about to go down so render any IDataObject that may be left in the clipboard */
3421 
3422  // TODO: rip down everything
3423  {
3425 
3426  fCurrentShellView->DestroyViewWindow();
3427  fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
3428 
3429  for (int i = 0; i < 3; i++)
3430  {
3432  CComPtr<IDeskBar> bar;
3433  CComPtr<IUnknown> pBarSite;
3434  CComPtr<IDeskBarClient> pClient;
3435 
3436  if (fClientBars[i].clientBar == NULL)
3437  continue;
3438 
3439  hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
3440  if (FAILED_UNEXPECTEDLY(hr))
3441  continue;
3442 
3443  /* We should destroy our basebarsite too */
3444  hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
3445  if (SUCCEEDED(hr))
3446  {
3447  hr = bar->GetClient(&pBarSite);
3448  if (SUCCEEDED(hr) && pBarSite)
3449  {
3450  hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
3451  if (SUCCEEDED(hr))
3452  pClient->SetDeskBarSite(NULL);
3453  }
3454  }
3455  pdw->CloseDW(0);
3456 
3457  pClient = NULL;
3458  pBarSite = NULL;
3459  pdw = NULL;
3460  bar = NULL;
3461  ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
3462  }
3463  ReleaseCComPtrExpectZero(fCurrentShellView);
3464  ReleaseCComPtrExpectZero(fTravelLog);
3465 
3470  }
3471  PostQuitMessage(0);
3472  return 0;
3473 }
3474 
3476 {
3477  CComPtr<IDockingWindow> dockingWindow;
3478  RECT availableBounds;
3479  static const INT excludeItems[] = {1, 1, 1, 0xa001, 0, 0};
3480  HRESULT hResult;
3481 
3482  if (wParam != SIZE_MINIMIZED)
3483  {
3484  GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3485  for (INT x = 0; x < 3; x++)
3486  {
3487  if (fClientBars[x].clientBar != NULL)
3488  {
3489  hResult = fClientBars[x].clientBar->QueryInterface(
3490  IID_PPV_ARG(IDockingWindow, &dockingWindow));
3491  if (SUCCEEDED(hResult) && dockingWindow != NULL)
3492  {
3493  hResult = dockingWindow->ResizeBorderDW(
3494  &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3495  break;
3496  }
3497  }
3498  }
3499  RepositionBars();
3500  }
3501  return 1;
3502 }
3503 
3505 {
3506  HMENU theMenu;
3507  LPARAM menuIndex = lParam;
3508 
3509  theMenu = reinterpret_cast<HMENU>(wParam);
3510 
3512  {
3513  menuIndex = 0;
3514  }
3515  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_EDIT))
3516  {
3517  menuIndex = 1;
3518  }
3519  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3520  {
3521  UpdateViewMenu(theMenu);
3522  menuIndex = 2;
3523  }
3525  {
3526  menuIndex = 3;
3527  }
3528  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_TOOLS))
3529  {
3530  // FIXME: Remove once implemented
3533  menuIndex = 4;
3534  }
3535  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP))
3536  {
3537  menuIndex = 5;
3538  }
3539 
3540  LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
3541 
3542  return ret;
3543 }
3544 
3546 {
3548  return 0;
3549 }
3550 
3552 {
3555  return 0;
3556 }
3557 
3559 {
3561  return 0;
3562 }
3563 
3564 LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3565 {
3566  return SendMessage(WM_CLOSE);
3567 }
3568 
3569 LRESULT CShellBrowser::OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3570 {
3571  HRESULT hResult = DoFolderOptions();
3572  if (FAILED(hResult))
3573  TRACE("DoFolderOptions failed with hResult=%08lx\n", hResult);
3574  return 0;
3575 }
3576 
3577 LRESULT CShellBrowser::OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3578 {
3579 #ifndef __REACTOS__
3581 #endif /* __REACTOS__ */
3582  return 0;
3583 }
3584 
3585 LRESULT CShellBrowser::OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3586 {
3588  return 0;
3589 }
3590 
3591 LRESULT CShellBrowser::OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3592 {
3593  ShellAbout(m_hWnd, _T("ReactOS"), NULL, NULL);
3594  return 0;
3595 }
3596 
3597 LRESULT CShellBrowser::OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3598 {
3599  HRESULT hResult = GoBack();
3600  if (FAILED(hResult))
3601  TRACE("GoBack failed with hResult=%08lx\n", hResult);
3602  return 0;
3603 }
3604 
3605 LRESULT CShellBrowser::OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3606 {
3607  HRESULT hResult = GoForward();
3608  if (FAILED(hResult))
3609  TRACE("GoForward failed with hResult=%08lx\n", hResult);
3610  return 0;
3611 }
3612 
3613 LRESULT CShellBrowser::OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3614 {
3615  HRESULT hResult = NavigateToParent();
3616  if (FAILED(hResult))
3617  TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3618  return 0;
3619 }
3620 
3621 LRESULT CShellBrowser::OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3622 {
3623  HRESULT hResult = GoHome();
3624  if (FAILED(hResult))
3625  TRACE("GoHome failed with hResult=%08lx\n", hResult);
3626  return 0;
3627 }
3628 
3629 LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3630 {
3631  // FIXME: This does not appear to be what windows does.
3632  HRESULT hResult = NavigateToParent();
3633  if (FAILED(hResult))
3634  TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3635  return 0;
3636 }
3637 
3638 LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3639 {
3640  CComPtr<IShellFolder> psfDesktop;
3641  LPITEMIDLIST pidlFavs;
3642  HRESULT hr;
3644  if (FAILED(hr))
3645  {
3647  if (FAILED(hr))
3648  return 0;
3649  }
3650 
3651  hr = SHGetDesktopFolder(&psfDesktop);
3652  if (FAILED_UNEXPECTEDLY(hr))
3653  return 0;
3654 
3655  hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
3656  if (FAILED_UNEXPECTEDLY(hr))
3657  return 0;
3658 
3659  return 0;
3660 }
3661 
3662 LRESULT CShellBrowser::OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3663 {
3665  if (fStatusBar)
3666  {
3668  RepositionBars();
3669  }
3670  return 0;
3671 }
3672 
3673 LRESULT CShellBrowser::OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3674 {
3675  HRESULT hResult;
3676  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3677  CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
3678  return 0;
3679 }
3680 
3682 {
3683  HRESULT hResult;
3684  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3685  CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
3686  return 0;
3687 }
3688 
3690 {
3691  HRESULT hResult;
3692  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3693  CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
3694  return 0;
3695 }
3696 
3697 LRESULT CShellBrowser::OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3698 {
3699  HRESULT hResult;
3700  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3701  CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
3702  return 0;
3703 }
3704 
3705 LRESULT CShellBrowser::OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3706 {
3707  HRESULT hResult;
3708  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3709  CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
3710  return 0;
3711 }
3712 
3713 LRESULT CShellBrowser::OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3714 {
3715  HRESULT hResult;
3716  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3717  CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
3718  return 0;
3719 }
3720 
3721 LRESULT CShellBrowser::OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3722 {
3723  if (fCurrentShellView)
3724  fCurrentShellView->Refresh();
3725  return 0;
3726 }
3727 
3728 LRESULT CShellBrowser::OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3729 {
3730  return 0;
3731 }
3732 
3733 LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3734 {
3735  // TODO: HACK ! use the proper mechanism to show the band (i.e. pass the BSTR to basebar)
3737  {
3738  MenuBandInfo *mbi;
3740  if (!mbi)
3741  return 0;
3742  ShowBand(mbi->barGuid, mbi->fVertical);
3743  bHandled = TRUE;
3744  return 1;
3745  }
3746  switch (wID)
3747  {
3749  ShowBand(CLSID_FileSearchBand, true);
3750  break;
3752  ShowBand(CLSID_ExplorerBand, true);
3753  break;
3755  ShowBand(CLSID_SH_HistBand, true);
3756  break;
3758  ShowBand(CLSID_SH_FavBand, true);
3759  break;
3760  default:
3761  WARN("Unknown id %x\n", wID);
3762  }
3763  bHandled = TRUE;
3764  return 1;
3765 }
3766 
3768 {
3771  return 0;
3772 }
3773 
3775 {
3776  return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3777 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
virtual HRESULT STDMETHODCALLTYPE OnSize(WPARAM wParam)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
UINT uiCP
Definition: tlogstg.idl:25
virtual HRESULT STDMETHODCALLTYPE InitializeDownloadManager()
#define STATUSCLASSNAMEW
Definition: commctrl.h:1932
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2374
LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: cache.c:48
#define DISPID_COMMANDSTATECHANGE
Definition: webchild.h:40
#define IDM_TOOLBARS_ADDRESSBAR
Definition: resource.h:31
virtual WNDPROC GetWindowProc()
virtual HRESULT STDMETHODCALLTYPE GetPositionCookie(DWORD *pdwPositioncookie)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1129
HRESULT BuildExplorerBandMenu()
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDM_VIEW_STATUSBAR
Definition: resource.h:37
CComPtr< IExplorerToolbar > fExplorerToolbar
int MapWindowPoints(HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
Definition: atlwin.h:922
GLint level
Definition: gl.h:1546
static const int BIHorizontalBaseBar
virtual HRESULT STDMETHODCALLTYPE _GetViewBorderRect(RECT *prc)
virtual HRESULT STDMETHODCALLTYPE _ResizeView()
IUnknown ** begin()
Definition: atlcom.h:1064
LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
DWORD dwWindowID
Definition: tlogstg.idl:24
#define IDM_TOOLBARS_LINKSBAR
Definition: resource.h:32
static HICON
Definition: imagelist.c:84
virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf)
IStream * fHistoryStream
virtual HRESULT STDMETHODCALLTYPE GetOleObject(IOleObject **ppobjv)
LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorder(UINT itb)
HWND SetFocus()
Definition: atlwin.h:1130
#define IDM_GOTO_UPONELEVEL
Definition: resource.h:47
#define TLOG_BACK
Definition: shlobj.h:2531
#define IDM_EXPLORERBAR_SEARCH
Definition: resource.h:39
#define SID_ITargetFrame2
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1517
LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
Definition: compat.h:1947
#define FCIDM_MENU_HELP
Definition: shlobj.h:562
virtual HRESULT STDMETHODCALLTYPE IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut)
#define IDM_GOTO_FORWARD
Definition: resource.h:46
virtual HRESULT STDMETHODCALLTYPE put_Offline(VARIANT_BOOL bOffline)
#define MF_BYCOMMAND
Definition: winuser.h:202
virtual HRESULT STDMETHODCALLTYPE v_ShowHideChildWindows(BOOL fChildOnly)
#define CGID_InternetButtons
Definition: shlguid.h:243
static const long BTP_UPDATE_NEXT_HISTORY
#define IDM_VIEW_TOOLBARS
Definition: resource.h:29
Type
Definition: Type.h:6
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
#define FCIDM_MENU_TOOLS
Definition: shlobj.h:560
#define SBT_TOOLTIPS
Definition: commctrl.h:1921
#define CreateWindow
Definition: winuser.h:5729
virtual HRESULT STDMETHODCALLTYPE v_MayTranslateAccelerator(MSG *pmsg)
#define IDM_EXPLORERBAR_SEPARATOR
Definition: resource.h:44
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDM_GOTO_TRAVEL_FIRST
Definition: resource.h:81
virtual HRESULT STDMETHODCALLTYPE IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivateBS(BOOL fActive)
virtual HRESULT STDMETHODCALLTYPE get_Height(long *pl)
LPWSTR lpszUrl
Definition: tlogstg.idl:27
#define IDI_CABINET
Definition: resource.h:10
virtual int STDMETHODCALLTYPE _GetToolbarCount()
#define InsertMenu
Definition: winuser.h:5778
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
virtual HRESULT STDMETHODCALLTYPE _SaveToolbars(IStream *pstm)
static BYTE int2[]
Definition: cert.c:3155
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
void Initialize(HWND parent, IUnknown *explorerToolbar)
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2041
#define pt(x, y)
Definition: drawing.c:79
virtual HRESULT STDMETHODCALLTYPE GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
virtual HRESULT STDMETHODCALLTYPE SetActivateState(UINT u)
#define WM_INITMENUPOPUP
Definition: winuser.h:1728
HRESULT DoFolderOptions()
#define SW_HIDE
Definition: winuser.h:762
REFIID riid
Definition: precomp.h:44
virtual HRESULT STDMETHODCALLTYPE UpdateBackForwardState()
virtual DWORD STDMETHODCALLTYPE GetBrowserIndex()
#define ITID_LINKSBANDSHOWN
Definition: undocshell.h:654
#define IDM_FAVORITES_EMPTY
Definition: resource.h:52
virtual HRESULT STDMETHODCALLTYPE AllowViewResize(BOOL f)
struct IOleCommandTarget::_tagOLECMD OLECMD
virtual HRESULT STDMETHODCALLTYPE put_MenuBar(VARIANT_BOOL Value)
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1637
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
DWORD WINAPI WNetDisconnectDialog(HWND hwnd, DWORD dwType)
Definition: wnet.c:2952
virtual HRESULT STDMETHODCALLTYPE put_Height(long Height)
LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
virtual LRESULT STDMETHODCALLTYPE WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual HRESULT STDMETHODCALLTYPE _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder *lpFolder, LPCITEMIDLIST lpApidl)
Definition: ordinal.c:2974
virtual HRESULT STDMETHODCALLTYPE InitializeTravelLog(ITravelLog *ptl, DWORD dw)
virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags, DWORD dwFlagMask)
const GUID IID_IPersist
Definition: proxy.cpp:14
HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
#define V_ARRAY(A)
Definition: oleauto.h:222
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
enum tagBNSTATE BNSTATE
BOOL WINAPI DSA_Destroy(HDSA hdsa)
Definition: dsa.c:103
virtual HRESULT STDMETHODCALLTYPE SetTopBrowser()
LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
#define WARN(fmt,...)
Definition: debug.h:111
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
CToolbarProxy fToolbarProxy
virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch **ppDisp)
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define IDM_TOOLS_MAPNETWORKDRIVE
Definition: resource.h:53
#define CALLBACK
Definition: compat.h:27
#define WM_SETREDRAW
Definition: winuser.h:1598
virtual HRESULT STDMETHODCALLTYPE _SendChildren(HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IConnectionPointContainer
virtual HRESULT STDMETHODCALLTYPE get_TheaterMode(VARIANT_BOOL *pbRegister)
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1220
LONG top
Definition: windef.h:307
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
#define IDM_CABINET_CONTEXTMENU
Definition: resource.h:87
#define COMMAND_RANGE_HANDLER(idFirst, idLast, func)
Definition: atlwin.h:1853
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText)
virtual HRESULT STDMETHODCALLTYPE get_Width(long *pl)
const char * wine_dbgstr_guid(const GUID *guid)
#define IDM_FAVORITES_ORGANIZEFAVORITES
Definition: resource.h:51
virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)