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