ReactOS  0.4.13-dev-1000-gbfea773
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
1238  {
1239  TRACE("A different CLSID requested, using CoCreateInstance.\n");
1240  hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1241  if (FAILED_UNEXPECTEDLY(hResult))
1242  return hResult;
1243  }
1244  }
1245  else
1246  {
1247  CComPtr<IBandSite> pBandSite;
1248 
1249  hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
1250  if (!SUCCEEDED(hResult))
1251  {
1252  ERR("Can't get IBandSite interface\n");
1253  return E_FAIL;
1254  }
1255  hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
1256  if (!SUCCEEDED(hResult))
1257  {
1258  ERR("Can't find band object\n");
1259  return E_FAIL;
1260  }
1261 
1262  // It's hackish, but we should be able to show the wanted band until we
1263  // find the proper way to do this (but it seems to work to add a new band)
1264  // Here we'll just re-add the existing band to the site, causing it to display.
1265  }
1266  V_VT(&vaIn) = VT_UNKNOWN;
1267  V_UNKNOWN(&vaIn) = newBand.p;
1268  hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
1269  if (FAILED_UNEXPECTEDLY(hResult))
1270  {
1271  return hResult;
1272  }
1273 
1274  hResult = dockingWindow->ShowDW(TRUE);
1275  if (FAILED_UNEXPECTEDLY(hResult))
1276  return hResult;
1277 
1278  if (vertical)
1279  {
1280  fCurrentVertBar = classID;
1282  }
1283 
1284  return S_OK;
1285 }
1286 
1288 {
1289  LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL);
1290  if (newDirectory == NULL)
1291  return E_OUTOFMEMORY;
1292  if (_ILIsDesktop(newDirectory))
1293  {
1294  ILFree(newDirectory);
1295  return E_INVALIDARG;
1296  }
1297  ILRemoveLastID(newDirectory);
1299  ILFree(newDirectory);
1300  if (FAILED_UNEXPECTEDLY(hResult))
1301  return hResult;
1302  return S_OK;
1303 }
1304 
1306 {
1307  PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1308  if (sheetInfo->nPages >= folderOptionsPageCountMax)
1309  return FALSE;
1310  sheetInfo->phpage[sheetInfo->nPages] = thePage;
1311  sheetInfo->nPages++;
1312  return TRUE;
1313 }
1314 
1316 {
1317  CComPtr<IShellPropSheetExt> folderOptionsSheet;
1318  PROPSHEETHEADER m_PropSheet;
1320 // CComPtr<IGlobalFolderSettings> globalSettings;
1321 // SHELLSTATE2 shellState;
1322  HRESULT hResult;
1323 
1324  memset(m_psp, 0, sizeof(m_psp));
1325  memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1326 
1327  // create sheet object
1328  hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1329  IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1330  if (FAILED_UNEXPECTEDLY(hResult))
1331  return E_FAIL;
1332 
1333  // must set site in order for Apply to all Folders on Advanced page to be enabled
1334  hResult = IUnknown_SetSite(folderOptionsSheet, static_cast<IDispatch *>(this));
1335  m_PropSheet.phpage = m_psp;
1336 
1337 #if 0
1338  hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1339  if (FAILED_UNEXPECTEDLY(hResult))
1340  return E_FAIL;
1341  hResult = globalSettings->Get(&shellState, sizeof(shellState));
1342  if (FAILED_UNEXPECTEDLY(hResult))
1343  return E_FAIL;
1344 #endif
1345 
1346  // add pages
1347  hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1348  if (FAILED_UNEXPECTEDLY(hResult))
1349  return E_FAIL;
1350 
1351 // CORE-11140 : Disabled this bit, because it prevents the folder options from showing.
1352 // It returns 'E_NOTIMPL'
1353 #if 0
1354  if (fCurrentShellView != NULL)
1355  {
1356  hResult = fCurrentShellView->AddPropertySheetPages(
1357  0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1358  if (FAILED_UNEXPECTEDLY(hResult))
1359  return E_FAIL;
1360  }
1361 #endif
1362 
1363  // show sheet
1364  CStringW strFolderOptions(MAKEINTRESOURCEW(IDS_FOLDER_OPTIONS));
1365  m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1366  m_PropSheet.dwFlags = 0;
1367  m_PropSheet.hwndParent = m_hWnd;
1368  m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1369  m_PropSheet.pszCaption = strFolderOptions;
1370  m_PropSheet.nStartPage = 0;
1371  PropertySheet(&m_PropSheet);
1372  return S_OK;
1373 }
1374 
1376 {
1377  CShellBrowser *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1378  _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1379  LRESULT lResult;
1380  const _ATL_MSG *previousMessage;
1381  BOOL handled;
1382  WNDPROC saveWindowProc;
1383  HRESULT hResult;
1384 
1385  hWnd = pThis->m_hWnd;
1386  previousMessage = pThis->m_pCurrentMsg;
1387  pThis->m_pCurrentMsg = &msg;
1388 
1389  /* If the shell browser is initialized, let the menu band preprocess the messages */
1390  if (pThis->fCurrentDirectoryPIDL)
1391  {
1392  CComPtr<IMenuBand> menuBand;
1393  hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1394  if (SUCCEEDED(hResult) && menuBand.p != NULL)
1395  {
1396  hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1397  if (hResult == S_OK)
1398  return lResult;
1399  uMsg = msg.message;
1400  wParam = msg.wParam;
1401  lParam = msg.lParam;
1402  }
1403  menuBand.Release();
1404  }
1405 
1406  handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1407  ATLASSERT(pThis->m_pCurrentMsg == &msg);
1408  if (handled == FALSE)
1409  {
1410  if (uMsg == WM_NCDESTROY)
1411  {
1412  saveWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
1413  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1414  if (saveWindowProc == reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)))
1416  pThis->m_dwState |= WINSTATE_DESTROYED;
1417  }
1418  else
1419  lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1420  }
1421  pThis->m_pCurrentMsg = previousMessage;
1422  if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1423  {
1424  pThis->m_dwState &= ~WINSTATE_DESTROYED;
1425  pThis->m_hWnd = NULL;
1426  pThis->OnFinalMessage(hWnd);
1427  }
1428  return lResult;
1429 }
1430 
1432 {
1433  RECT clientRect;
1434  RECT statusRect;
1435  int x;
1436 
1437  GetClientRect(&clientRect);
1438 
1440  {
1441  ::GetWindowRect(fStatusBar, &statusRect);
1442  ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1443  clientRect.right - clientRect.left,
1444  statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1445  clientRect.bottom -= statusRect.bottom - statusRect.top;
1446  }
1447 
1448  for (x = 0; x < 3; x++)
1449  {
1450  HWND hwnd = fClientBars[x].hwnd;
1451  RECT borderSpace = fClientBars[x].borderSpace;
1452  if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1453  {
1454  IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1455  fClientBars[x].hwnd = hwnd;
1456  }
1457  if (hwnd != NULL)
1458  {
1459  RECT toolbarRect = clientRect;
1460  if (borderSpace.top != 0)
1461  {
1462  toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1463  }
1464  else if (borderSpace.bottom != 0)
1465  {
1466  toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1467  }
1468  else if (borderSpace.left != 0)
1469  {
1470  toolbarRect.right = toolbarRect.left + borderSpace.left;
1471  }
1472  else if (borderSpace.right != 0)
1473  {
1474  toolbarRect.left = toolbarRect.right - borderSpace.right;
1475  }
1476 
1478  toolbarRect.left,
1479  toolbarRect.top,
1480  toolbarRect.right - toolbarRect.left,
1481  toolbarRect.bottom - toolbarRect.top,
1483 
1484  if (borderSpace.top != 0)
1485  {
1486  clientRect.top = toolbarRect.bottom;
1487  }
1488  else if (borderSpace.bottom != 0)
1489  {
1490  clientRect.bottom = toolbarRect.top;
1491  }
1492  else if (borderSpace.left != 0)
1493  {
1494  clientRect.left = toolbarRect.right;
1495  }
1496  else if (borderSpace.right != 0)
1497  {
1498  clientRect.right = toolbarRect.left;
1499  }
1500  }
1501  }
1502  ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1503  clientRect.right - clientRect.left,
1504  clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1505 }
1506 
1507 HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1508 {
1512  HRESULT hResult;
1513 
1514  params.rgvarg = arguments;
1515  params.rgdispidNamedArgs = NULL;
1516  params.cArgs = argCount;
1517  params.cNamedArgs = 0;
1518  IUnknown** pp = vec.begin();
1519  while (pp < vec.end())
1520  {
1521  if (*pp != NULL)
1522  {
1523  CComPtr<IDispatch> theDispatch;
1524 
1525  hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1526  hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1527  }
1528  pp++;
1529  }
1530  pp = vec2.begin();
1531  while (pp < vec2.end())
1532  {
1533  if (*pp != NULL)
1534  {
1535  CComPtr<IDispatch> theDispatch;
1536 
1537  hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1538  hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1539  }
1540  pp++;
1541  }
1542  return S_OK;
1543 }
1544 
1545 HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1546 {
1547  // these two variants intentionally to do use CComVariant because it would double free/release
1548  // or does not need to dispose at all
1549  VARIANT varArg[2];
1550  VARIANT varArgs;
1551  CComBSTR tempString(newDirectory);
1552 
1553  V_VT(&varArgs) = VT_BSTR;
1554  V_BSTR(&varArgs) = tempString.m_str;
1555 
1556  V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1557  V_VARIANTREF(&varArg[0]) = &varArgs;
1558  V_VT(&varArg[1]) = VT_DISPATCH;
1559  V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1560 
1561  return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1562 }
1563 
1564 HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1565 {
1566  VARIANT varArg[2];
1567 
1568  V_VT(&varArg[0]) = VT_BOOL;
1569  V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1570  V_VT(&varArg[1]) = VT_I4;
1571  V_I4(&varArg[1]) = commandID;
1572 
1573  return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1574 }
1575 
1577 {
1578  return FireCommandStateChange(false, -1);
1579 }
1580 
1582 {
1583  CComPtr<ITravelLog> travelLog;
1584  CComPtr<ITravelEntry> unusedEntry;
1585  bool canGoBack;
1586  bool canGoForward;
1587  HRESULT hResult;
1588 
1589  canGoBack = false;
1590  canGoForward = false;
1591  hResult = GetTravelLog(&travelLog);
1592  if (FAILED_UNEXPECTEDLY(hResult))
1593  return hResult;
1594  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1595  if (SUCCEEDED(hResult))
1596  {
1597  canGoBack = true;
1598  unusedEntry.Release();
1599  }
1600  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1601  if (SUCCEEDED(hResult))
1602  {
1603  canGoForward = true;
1604  unusedEntry.Release();
1605  }
1606  hResult = FireCommandStateChange(canGoBack, 2);
1607  hResult = FireCommandStateChange(canGoForward, 1);
1608  return S_OK;
1609 }
1610 
1612 {
1613  bool canGoUp;
1614  HRESULT hResult;
1615 
1616  canGoUp = true;
1618  canGoUp = false;
1619  hResult = FireCommandStateChange(canGoUp, 3);
1620  return S_OK;
1621 }
1622 
1624 {
1625  CComPtr<ITravelLog> travelLog;
1626  CComPtr<ITravelEntry> unusedEntry;
1627  int position;
1628  MENUITEMINFO menuItemInfo;
1629  HRESULT hResult;
1630 
1632 
1633  position = GetMenuItemCount(theMenu);
1634  hResult = GetTravelLog(&travelLog);
1635  if (FAILED_UNEXPECTEDLY(hResult))
1636  return;
1637 
1638  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1639  TLOG_BACK,
1640  &unusedEntry);
1641 
1642  if (SUCCEEDED(hResult))
1643  {
1644  SHEnableMenuItem(theMenu, IDM_GOTO_BACK, TRUE);
1645  unusedEntry.Release();
1646  }
1647  else
1649 
1650  hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1651  TLOG_FORE,
1652  &unusedEntry);
1653 
1654  if (SUCCEEDED(hResult))
1655  {
1657  unusedEntry.Release();
1658  }
1659  else
1661 
1662  SHEnableMenuItem(theMenu,
1665 
1666  hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1668  if (SUCCEEDED(hResult))
1669  {
1670  menuItemInfo.cbSize = sizeof(menuItemInfo);
1671  menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1672  menuItemInfo.fType = MF_SEPARATOR;
1673  menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1674  InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1675  }
1676 }
1677 
1679 {
1680  CComPtr<ITravelLog> travelLog;
1681  HMENU gotoMenu;
1682  OLECMD commandList[5];
1683  HMENU toolbarMenuBar;
1684  HMENU toolbarMenu;
1685  MENUITEMINFO menuItemInfo;
1686  HRESULT hResult;
1687 
1688  gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1689  if (gotoMenu != NULL)
1690  UpdateGotoMenu(gotoMenu);
1691 
1692  commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1693  commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1694  commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1695  commandList[3].cmdID = ITID_TOOLBARLOCKED;
1696  commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1697 
1698  hResult = IUnknown_QueryStatus(fClientBars[BIInternetToolbar].clientBar,
1699  CGID_PrivCITCommands, 5, commandList, NULL);
1700  if (FAILED_UNEXPECTEDLY(hResult))
1702  else
1703  {
1704  menuItemInfo.cbSize = sizeof(menuItemInfo);
1705  menuItemInfo.fMask = MIIM_SUBMENU;
1706  GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1707  DestroyMenu(menuItemInfo.hSubMenu);
1708 
1709  toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1710  toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1711  RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION);
1712  DestroyMenu(toolbarMenuBar);
1713 
1714  // TODO: Implement
1715  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_ENABLED);
1716  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1717  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1718  SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, commandList[4].cmdf & OLECMDF_ENABLED);
1719 
1720  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_LATCHED);
1721  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_LATCHED);
1722  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_LATCHED);
1723  SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_LATCHED);
1724  if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1728 
1729  menuItemInfo.cbSize = sizeof(menuItemInfo);
1730  menuItemInfo.fMask = MIIM_SUBMENU;
1731  menuItemInfo.hSubMenu = toolbarMenu;
1732  SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1733  }
1735 }
1736 
1738 {
1739  HMENU hBandsMenu;
1740  UINT nbFound;
1741 
1743  if (!hBandsMenu)
1744  {
1745  OutputDebugString(L"No menu !\n");
1746  return E_FAIL;
1747  }
1749  BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
1750  BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
1751  if (!nbFound)
1752  {
1753  // Remove separator
1755  }
1756  // Remove media menu since XP does it (according to API Monitor)
1758  return S_OK;
1759 }
1760 
1762 {
1763  HRESULT hr;
1764  CComPtr<IEnumGUID> pEnumGUID;
1765  WCHAR wszBandName[MAX_PATH];
1766  WCHAR wszBandGUID[MAX_PATH];
1767  WCHAR wRegKey[MAX_PATH];
1768  UINT cBands;
1769  DWORD dwRead;
1770  DWORD dwDataSize;
1771  GUID iter;
1772  MenuBandInfo mbi;
1773 
1774  mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
1775  cBands = 0;
1776  hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
1777  if (FAILED_UNEXPECTEDLY(hr))
1778  {
1779  return hr;
1780  }
1781  do
1782  {
1783  pEnumGUID->Next(1, &iter, &dwRead);
1784  if (dwRead)
1785  {
1786  // Get the band name
1787  if (IsBuiltinBand(iter))
1788  continue;
1789  if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
1790  continue;
1791  StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
1792  dwDataSize = MAX_PATH;
1793  SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
1794 
1795  mbi.barGuid = iter;
1796  InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
1797  DSA_AppendItem(menuDsa, &mbi);
1798  cBands++;
1799  }
1800  }
1801  while (dwRead > 0);
1802  if (nbFound)
1803  *nbFound = cBands;
1804  return S_OK;
1805 }
1806 
1808 {
1809  if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
1810  return TRUE;
1811  if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
1812  return TRUE;
1813  if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
1814  return TRUE;
1815  if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
1816  return TRUE;
1817  if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
1818  return TRUE;
1819  if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
1820  return TRUE;
1821  return FALSE;
1822 }
1823 
1825 {
1826  CComPtr<IObjectWithSite> objectWithSite;
1827  CComPtr<IContextMenu> contextMenu;
1828  CMINVOKECOMMANDINFO commandInfo;
1829  const char *searchGUID = "{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
1830  HRESULT hResult;
1831 
1832  // TODO: Query shell if this command is enabled first
1833 
1834  memset(&commandInfo, 0, sizeof(commandInfo));
1835  commandInfo.cbSize = sizeof(commandInfo);
1836  commandInfo.hwnd = m_hWnd;
1837  commandInfo.lpParameters = searchGUID;
1838  commandInfo.nShow = SW_SHOWNORMAL;
1839 
1840  hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
1841  IID_PPV_ARG(IContextMenu, &contextMenu));
1842  if (FAILED_UNEXPECTEDLY(hResult))
1843  return 0;
1844  hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1845  if (FAILED_UNEXPECTEDLY(hResult))
1846  return 0;
1847  hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
1848  if (FAILED_UNEXPECTEDLY(hResult))
1849  return 0;
1850  hResult = contextMenu->InvokeCommand(&commandInfo);
1851  hResult = objectWithSite->SetSite(NULL);
1852  return hResult;
1853 }
1854 
1856 {
1857  CComPtr<IUnknown> int1Retry;
1858  CComPtr<IUnknown> int2Retry;
1859  HRESULT hResult;
1860 
1861  if (int1 == int2)
1862  return true;
1863  if (int1 == NULL || int2 == NULL)
1864  return false;
1865  hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1866  if (FAILED_UNEXPECTEDLY(hResult))
1867  return false;
1868  hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1869  if (FAILED_UNEXPECTEDLY(hResult))
1870  return false;
1871  if (int1Retry == int2Retry)
1872  return true;
1873  return false;
1874 }
1875 
1877 {
1878  static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
1879 
1880  RECT availableBounds;
1881 
1882  GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1883  for (INT x = 0; x < 3; x++)
1884  {
1885  if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1886  {
1887  availableBounds.top += fClientBars[x].borderSpace.top;
1888  availableBounds.left += fClientBars[x].borderSpace.left;
1889  availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1890  availableBounds.right -= fClientBars[x].borderSpace.right;
1891  }
1892  }
1893  *prcBorder = availableBounds;
1894  return S_OK;
1895 }
1896 
1898 {
1899  return S_OK;
1900 }
1901 
1903 {
1904  for (INT x = 0; x < 3; x++)
1905  {
1906  if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1907  {
1908  fClientBars[x].borderSpace = *pbw;
1909  // if this bar changed size, it cascades and forces all subsequent bars to resize
1910  RepositionBars();
1911  return S_OK;
1912  }
1913  }
1914  return E_INVALIDARG;
1915 }
1916 
1918  ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
1919 {
1920  CComPtr<IOleCommandTarget> commandTarget;
1921  HRESULT hResult;
1922 
1923  if (prgCmds == NULL)
1924  return E_INVALIDARG;
1925  if (pguidCmdGroup == NULL)
1926  {
1927  if (fCurrentShellView.p != NULL)
1928  {
1929  hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
1930  if (SUCCEEDED(hResult) && commandTarget.p != NULL)
1931  return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
1932  }
1933  while (cCmds != 0)
1934  {
1935  prgCmds->cmdf = 0;
1936  prgCmds++;
1937  cCmds--;
1938  }
1939  }
1940  else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1941  {
1942  while (cCmds != 0)
1943  {
1944  switch (prgCmds->cmdID)
1945  {
1946  case 0x1c: // search
1947  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1948  if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
1949  IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
1950  IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
1951  IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
1952  {
1953  prgCmds->cmdf |= OLECMDF_LATCHED;
1954  }
1955  break;
1956  case 0x1d: // history
1957  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1958  if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
1959  prgCmds->cmdf |= OLECMDF_LATCHED;
1960  break;
1961  case 0x1e: // favorites
1962  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1963  if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
1964  prgCmds->cmdf |= OLECMDF_LATCHED;
1965  break;
1966  case 0x23: // folders
1967  prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1968  if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
1969  prgCmds->cmdf |= OLECMDF_LATCHED;
1970  break;
1971  default:
1972  prgCmds->cmdf = 0;
1973  break;
1974  }
1975  prgCmds++;
1976  cCmds--;
1977  }
1978  }
1979  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1980  {
1981  while (cCmds != 0)
1982  {
1983  switch (prgCmds->cmdID)
1984  {
1985  case 0xa022: // up level
1986  prgCmds->cmdf = OLECMDF_SUPPORTED;
1987  if (fCurrentDirectoryPIDL->mkid.cb != 0)
1988  prgCmds->cmdf |= OLECMDF_ENABLED;
1989  break;
1990  }
1991  prgCmds++;
1992  cCmds--;
1993  }
1994  }
1995  return S_OK;
1996 }
1997 
1999  DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2000 {
2001  HRESULT hResult;
2002 
2003  if (!pguidCmdGroup)
2004  {
2005  TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
2006  return E_NOTIMPL;
2007  }
2008  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2009  {
2010  switch (nCmdID)
2011  {
2012  case 0x1c: //Toggle Search
2013  if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
2014  IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
2015  IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
2016  IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
2017  {
2018  hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2019  memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2021  }
2022  else
2023  {
2024  OnSearch();
2025  }
2026  return S_OK;
2027  case 0x1d: //Toggle History
2028  case 0x1e: //Toggle Favorites
2029  case 0x23: //Toggle Folders
2030  const GUID* pclsid;
2031  if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
2032  else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
2033  else pclsid = &CLSID_ExplorerBand;
2034 
2035  if (IsEqualCLSID(*pclsid, fCurrentVertBar))
2036  {
2037  hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2038  memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2040  }
2041  else
2042  {
2043  hResult = ShowBand(*pclsid, true);
2044  }
2045  return S_OK;
2046  case 0x22:
2047  //Sent when a band closes
2048  if (V_VT(pvaIn) != VT_UNKNOWN)
2049  return E_INVALIDARG;
2050 
2051  if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
2052  {
2053  memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2055  }
2056  return S_OK;
2057  case 0x27:
2058  if (nCmdexecopt == 1)
2059  {
2060  // pvaIn is a VT_UNKNOWN with a band that is being hidden
2061  }
2062  else
2063  {
2064  // update zones part of the status bar
2065  }
2066  return S_OK;
2067  case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
2068  V_VT(pvaOut) = VT_INT_PTR;
2069  V_INTREF(pvaOut) = reinterpret_cast<INT *>(
2070  LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
2071  return S_OK;
2072  case 0x38:
2073  // indicate if this cabinet was opened as a browser
2074  return S_FALSE;
2075  default:
2076  return E_NOTIMPL;
2077  }
2078  }
2079  else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
2080  {
2081  switch (nCmdID)
2082  {
2083  case 0x23:
2084  // placeholder
2085  return S_OK;
2086  }
2087  }
2088  else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
2089  {
2090  switch (nCmdID)
2091  {
2092  case 6:
2093  // what is theater mode and why do we receive this?
2094  return E_NOTIMPL;
2095  }
2096  }
2097  else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
2098  {
2099  switch (nCmdID)
2100  {
2101  case 14:
2102  // initialize favorites menu
2103  return S_OK;
2104  }
2105  }
2106  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
2107  {
2108  switch (nCmdID)
2109  {
2110  case 0x12:
2111  // refresh on toolbar clicked
2112  return S_OK;
2113  case 0x26:
2114  // called for unknown bands ?
2115  return S_OK;
2116  case 0x4d:
2117  // tell the view if it should hide the task pane or not
2118  return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
2119  }
2120  }
2121  else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2122  {
2123  switch (nCmdID)
2124  {
2125  case 40994:
2126  return NavigateToParent();
2127  }
2128  }
2129  else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
2130  {
2131  switch (nCmdID)
2132  {
2133  case 0x7063:
2134  return DoFolderOptions();
2135  }
2136  }
2137  else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
2138  {
2139  switch (nCmdID)
2140  {
2141  case 1:
2142  // Reset All Folders option in Folder Options
2143  break;
2144  }
2145  }
2146  else
2147  {
2148  return E_NOTIMPL;
2149  }
2150  return E_NOTIMPL;
2151 }
2152 
2154 {
2155  if (lphwnd == NULL)
2156  return E_POINTER;
2157  *lphwnd = m_hWnd;
2158  return S_OK;
2159 }
2160 
2162 {
2163  return E_NOTIMPL;
2164 }
2165 
2166 HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
2167 {
2168  HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2169 
2170  Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
2171 
2172  int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
2173  Unused(itemCount3);
2174 
2175  DestroyMenu(mainMenu);
2176 
2177  lpMenuWidths->width[0] = 2;
2178  lpMenuWidths->width[2] = 3;
2179  lpMenuWidths->width[4] = 1;
2180  return S_OK;
2181 }
2182 
2183 HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
2184 {
2185  CComPtr<IShellMenu> shellMenu;
2186  HRESULT hResult;
2187 
2188  if (hmenuShared && IsMenu(hmenuShared) == FALSE)
2189  return E_FAIL;
2190  hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
2191  if (FAILED_UNEXPECTEDLY(hResult))
2192  return hResult;
2193 
2194  if (!hmenuShared)
2195  {
2196  hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2197  }
2198  // FIXME: Figure out the proper way to do this.
2199  HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
2200  if (hMenuFavs)
2201  {
2203  }
2204 
2205  hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
2206  if (FAILED_UNEXPECTEDLY(hResult))
2207  return hResult;
2208  fCurrentMenuBar = hmenuShared;
2210  return S_OK;
2211 }
2212 
2214 {
2215  if (hmenuShared == fCurrentMenuBar)
2216  {
2217  //DestroyMenu(fCurrentMenuBar);
2218  SetMenuSB(NULL, NULL, NULL);
2219  }
2220  return S_OK;
2221 }
2222 
2224 {
2225  //
2226  if (pszStatusText)
2227  {
2228  ::SetWindowText(fStatusBar, pszStatusText);
2229  }
2230  else
2231  {
2232 
2233  }
2234  return S_OK;
2235 }
2236 
2238 {
2239  return E_NOTIMPL;
2240 }
2241 
2243 {
2244  if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
2245  return S_FALSE;
2246  return S_OK;
2247 }
2248 
2250 {
2251  if ((wFlags & SBSP_EXPLOREMODE) != NULL)
2252  ShowBand(CLSID_ExplorerBand, true);
2253 
2255  if (fTravelLog)
2257  return BrowseToPIDL(pidl, flags);
2258 }
2259 
2261 {
2262  return E_NOTIMPL;
2263 }
2264 
2266 {
2267  if (lphwnd == NULL)
2268  return E_POINTER;
2269  *lphwnd = NULL;
2270  switch (id)
2271  {
2272  case FCW_TOOLBAR:
2273  *lphwnd = fToolbarProxy.m_hWnd;
2274  return S_OK;
2275  case FCW_STATUS:
2276  *lphwnd = fStatusBar;
2277  return S_OK;
2278  case FCW_TREE:
2279  // find the directory browser and return it
2280  // this should be used only to determine if a tree is present
2281  return S_OK;
2282  case FCW_PROGRESS:
2283  // is this a progress dialog?
2284  return S_OK;
2285  }
2286  return S_OK;
2287 }
2288 
2290  UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
2291 {
2292  LPARAM result;
2293 
2294  if (pret != NULL)
2295  *pret = 0;
2296  switch (id)
2297  {
2298  case FCW_TOOLBAR:
2300  if (pret != NULL)
2301  *pret = result;
2302  break;
2303  case FCW_STATUS:
2305  if (pret != NULL)
2306  *pret = result;
2307  break;
2308  }
2309  return S_OK;
2310 }
2311 
2313 {
2314  if (ppshv == NULL)
2315  return E_POINTER;
2316  *ppshv = fCurrentShellView;
2317  if (fCurrentShellView.p != NULL)
2319  return S_OK;
2320 }
2321 
2323 {
2324  return E_NOTIMPL;
2325 }
2326 
2328 {
2329  return E_NOTIMPL;
2330 }
2331 
2333  IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2334 {
2335  return E_NOTIMPL;
2336 }
2337 
2339 {
2340  return E_NOTIMPL;
2341 }
2342 
2344 {
2345  return E_NOTIMPL;
2346 }
2347 
2349  IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2350 {
2351  return E_NOTIMPL;
2352 }
2353 
2355 {
2356  // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2357  // the returned interface has a method GetPropertyBag on it
2358  if (IsEqualIID(guidService, SID_STopLevelBrowser))
2359  return this->QueryInterface(riid, ppvObject);
2360  if (IsEqualIID(guidService, SID_SShellBrowser))
2361  return this->QueryInterface(riid, ppvObject);
2362  if (IsEqualIID(guidService, SID_ITargetFrame2))
2363  return this->QueryInterface(riid, ppvObject);
2364  if (IsEqualIID(guidService, SID_IWebBrowserApp)) // without this, the internet toolbar won't reflect notifications
2365  return this->QueryInterface(riid, ppvObject);
2366  if (IsEqualIID(guidService, SID_SProxyBrowser))
2367  return this->QueryInterface(riid, ppvObject);
2368  if (IsEqualIID(guidService, SID_IExplorerToolbar))
2369  return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2370  if (IsEqualIID(riid, IID_IShellBrowser))
2371  return this->QueryInterface(riid, ppvObject);
2372  return E_NOINTERFACE;
2373 }
2374 
2376 {
2377  if (ppvObject == NULL)
2378  return E_POINTER;
2379  *ppvObject = NULL;
2380  return E_NOTIMPL;
2381 }
2382 
2384 {
2385  return E_NOTIMPL;
2386 }
2387 
2389 {
2390  return E_NOTIMPL;
2391 }
2392 
2394  UINT cNames, LCID lcid, DISPID *rgDispId)
2395 {
2396  return E_NOTIMPL;
2397 }
2398 
2400  WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2401 {
2402  return E_NOTIMPL;
2403 }
2404 
2406 {
2407  return E_NOTIMPL;
2408 }
2409 
2411 {
2412  return E_NOTIMPL;
2413 }
2414 
2416 {
2417  return E_NOTIMPL;
2418 }
2419 
2421 {
2422  return E_NOTIMPL;
2423 }
2424 
2426 {
2427  HRESULT hResult;
2428 
2429  // called by toolbar when displaying tooltips
2430  if (pptl == NULL)
2431  return E_FAIL;
2432 
2433  *pptl = NULL;
2434  if (fTravelLog.p == NULL)
2435  {
2437  if (FAILED_UNEXPECTEDLY(hResult))
2438  return hResult;
2439  }
2440  *pptl = fTravelLog.p;
2441  fTravelLog.p->AddRef();
2442  return S_OK;
2443 }
2444 
2446 {
2447  return E_NOTIMPL;
2448 }
2449 
2451 {
2452  return E_NOTIMPL;
2453 }
2454 
2456 {
2457  return E_NOTIMPL;
2458 }
2459 
2461 {
2462  return E_NOTIMPL;
2463 }
2464 
2466 {
2467  return E_NOTIMPL;
2468 }
2469 
2471 {
2472  return E_NOTIMPL;
2473 }
2474 
2476 {
2477  return E_NOTIMPL;
2478 }
2479 
2481 {
2482  return E_NOTIMPL;
2483 }
2484 
2486 {
2487  return E_NOTIMPL;
2488 }
2489 
2491 {
2492  return E_NOTIMPL;
2493 }
2494 
2496 {
2497  return E_NOTIMPL;
2498 }
2499 
2501 {
2502  return E_NOTIMPL;
2503 }
2504 
2506 {
2507  return E_NOTIMPL;
2508 }
2509 
2511 {
2512  return E_NOTIMPL;
2513 }
2514 
2516 {
2517  // called by explorer bar to get current pidl
2518  if (ppidl == NULL)
2519  return E_POINTER;
2520  *ppidl = ILClone(fCurrentDirectoryPIDL);
2521  return S_OK;
2522 }
2523 
2525 {
2526  return E_NOTIMPL;
2527 }
2528 
2530 {
2531  return -1;
2532 }
2533 
2535 {
2536  return E_NOTIMPL;
2537 }
2538 
2540 {
2541  if (ppole == NULL || pstm == NULL || ppbc == NULL)
2542  return E_INVALIDARG;
2543  *ppole = fHistoryObject;
2544  if (fHistoryObject != NULL)
2546  *pstm = fHistoryStream;
2547  if (fHistoryStream != NULL)
2549  *ppbc = fHistoryBindContext;
2550  if (fHistoryBindContext != NULL)
2552  fHistoryObject = NULL;
2553  fHistoryStream = NULL;
2555  if (*ppole == NULL)
2556  return E_FAIL;
2557  return S_OK;
2558 }
2559 
2561 {
2562  return E_NOTIMPL;
2563 }
2564 
2566 {
2567  return E_NOTIMPL;
2568 }
2569 
2571 {
2572  return E_NOTIMPL;
2573 }
2574 
2576  IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2577 {
2578  return E_NOTIMPL;
2579 }
2580 
2582 {
2583  return E_NOTIMPL;
2584 }
2585 
2587 {
2588  return E_NOTIMPL;
2589 }
2590 
2592 {
2593  return E_NOTIMPL;
2594 }
2595 
2597 {
2598  return E_NOTIMPL;
2599 }
2600 
2602 {
2603  return E_NOTIMPL;
2604 }
2605 
2607 {
2608  return E_NOTIMPL;
2609 }
2610 
2612 {
2614  return S_OK;
2615 }
2616 
2618 {
2619  return 0;
2620 }
2621 
2623 {
2624  return E_NOTIMPL;
2625 }
2626 
2628 {
2629  return 0;
2630 }
2631 
2633 {
2634  return E_NOTIMPL;
2635 }
2636 
2638 {
2639  return E_NOTIMPL;
2640 }
2641 
2643 {
2644  return E_NOTIMPL;
2645 }
2646 
2648 {
2649  return E_NOTIMPL;
2650 }
2651 
2653  IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2654 {
2655  return E_NOTIMPL;
2656 }
2657 
2659 {
2660  return E_NOTIMPL;
2661 }
2662 
2664 {
2665  return E_NOTIMPL;
2666 }
2667 
2669 {
2670  return E_NOTIMPL;
2671 }
2672 
2674 {
2675  return NULL;
2676 }
2677 
2679 {
2680  return E_NOTIMPL;
2681 }
2682 
2684 {
2685  return E_NOTIMPL;
2686 }
2687 
2689 {
2690  return E_NOTIMPL;
2691 }
2692 
2694 {
2695  return E_NOTIMPL;
2696 }
2697 
2699 {
2700  return E_NOTIMPL;
2701 }
2702 
2704 {
2705  return E_NOTIMPL;
2706 }
2707 
2709 {
2710  return E_NOTIMPL;
2711 }
2712 
2714 {
2715  return E_NOTIMPL;
2716 }
2717 
2719 {
2720  return E_NOTIMPL;
2721 }
2722 
2724 {
2725  return E_NOTIMPL;
2726 }
2727 
2729 {
2730  return E_NOTIMPL;
2731 }
2732 
2734 {
2735  return E_NOTIMPL;
2736 }
2737 
2739 {
2740  return E_NOTIMPL;
2741 }
2742 
2744 {
2745  return E_NOTIMPL;
2746 }
2747 
2749 {
2750  return E_NOTIMPL;
2751 }
2752 
2754 {
2755  return E_NOTIMPL;
2756 }
2757 
2759 {
2760  return E_NOTIMPL;
2761 }
2762 
2764  const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2765 {
2766  return E_NOTIMPL;
2767 }
2768 
2770  HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2771 {
2772  return E_NOTIMPL;
2773 }
2774 
2776 {
2777  return E_NOTIMPL;
2778 }
2779 
2781 {
2782  return E_NOTIMPL;
2783 }
2784 
2786 {
2787  return E_NOTIMPL;
2788 }
2789 
2791 {
2792  return 0;
2793 }
2794 
2796 {
2797  return E_NOTIMPL;
2798 }
2799 
2801 {
2802  return E_NOTIMPL;
2803 }
2804 
2806 {
2807  return E_NOTIMPL;
2808 }
2809 
2811 {
2812  return E_NOTIMPL;
2813 }
2814 
2816 {
2817  return E_NOTIMPL;
2818 }
2819 
2821 {
2822  return E_NOTIMPL;
2823 }
2824 
2826 {
2827  return E_NOTIMPL;
2828 }
2829 
2831 {
2832  return NULL;
2833 }
2834 
2836 {
2837  return 0;
2838 }
2839 
2841 {
2842  return E_NOTIMPL;
2843 }
2844 
2846 {
2847  return 0;
2848 }
2849 
2851 {
2852  return NULL;
2853 }
2854 
2856 {
2857  return E_NOTIMPL;
2858 }
2859 
2861 {
2862  return E_NOTIMPL;
2863 }
2864 
2866 {
2867  return E_NOTIMPL;
2868 }
2869 
2871  LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
2872 {
2873  return E_NOTIMPL;
2874 }
2875 
2877 {
2878  return E_NOTIMPL;
2879 }
2880 
2882 {
2883  return 0;
2884 }
2885 
2887 {
2888  return E_NOTIMPL;
2889 }
2890 
2892 {
2893  for (int i = 0; i < 3; i++)
2894  {
2895  if (IUnknown_TranslateAcceleratorIO(fClientBars[i].clientBar, pmsg) == S_OK)
2896  return S_OK;
2897  }
2898 
2899  if (!fCurrentShellView)
2900  return S_FALSE;
2901 
2902  return fCurrentShellView->TranslateAcceleratorW(pmsg);
2903 }
2904 
2906 {
2907  return E_NOTIMPL;
2908 }
2909 
2911 {
2912  return E_NOTIMPL;
2913 }
2914 
2916 {
2917  CComPtr<ITravelLog> travelLog;
2918  HRESULT hResult = GetTravelLog(&travelLog);
2919  if (FAILED_UNEXPECTEDLY(hResult))
2920  return hResult;
2921  return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
2922 }
2923 
2925 {
2926  CComPtr<ITravelLog> travelLog;
2927  HRESULT hResult = GetTravelLog(&travelLog);
2928  if (FAILED_UNEXPECTEDLY(hResult))
2929  return hResult;
2930  return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
2931 }
2932 
2934 {
2935  return E_NOTIMPL;
2936 }
2937 
2939 {
2940  return E_NOTIMPL;
2941 }
2942 
2944  VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2945 {
2947  HRESULT hResult;
2948  CComPtr<IShellFolder> pDesktop;
2949 
2950  hResult = SHGetDesktopFolder(&pDesktop);
2951  if (FAILED_UNEXPECTEDLY(hResult))
2952  return hResult;
2953  hResult = pDesktop->ParseDisplayName(NULL, NULL, URL, NULL, &pidl, NULL);
2954  if (FAILED_UNEXPECTEDLY(hResult))
2955  return hResult;
2956  return BrowseObject(pidl, 1);
2957 }
2958 
2960 {
2961  VARIANT level;
2962 
2963  V_VT(&level) = VT_I4;
2964  V_I4(&level) = 4;
2965  return Refresh2(&level);
2966 }
2967 
2969 {
2970  CComPtr<IOleCommandTarget> oleCommandTarget;
2971  HRESULT hResult;
2972 
2973  hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
2974  if (FAILED_UNEXPECTEDLY(hResult))
2975  return hResult;
2976  return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
2977 }
2978 
2980 {
2981  return E_NOTIMPL;
2982 }
2983 
2985 {
2986  return E_NOTIMPL;
2987 }
2988 
2990 {
2991  return E_NOTIMPL;
2992 }
2993 
2995 {
2996  return E_NOTIMPL;
2997 }
2998 
3000 {
3001  return E_NOTIMPL;
3002 }
3003 
3005 {
3006  return E_NOTIMPL;
3007 }
3008 
3010 {
3011  return E_NOTIMPL;
3012 }
3013 #ifdef __exdisp_h__
3014 #define long LONG
3015 #endif
3017 {
3018  return E_NOTIMPL;
3019 }
3020 
3022 {
3023  return E_NOTIMPL;
3024 }
3025 
3027 {
3028  return E_NOTIMPL;
3029 }
3030 
3032 {
3033  return E_NOTIMPL;
3034 }
3035 
3037 {
3038  return E_NOTIMPL;
3039 }
3040 
3042 {
3043  return E_NOTIMPL;
3044 }
3045 
3047 {
3048  return E_NOTIMPL;
3049 }
3050 
3052 {
3053  return E_NOTIMPL;
3054 }
3055 #ifdef __exdisp_h__
3056 #undef long
3057 #endif
3059 {
3060  return E_NOTIMPL;
3061 }
3062 
3064 {
3065  return E_NOTIMPL;
3066 }
3067 
3069 {
3070  return E_NOTIMPL;
3071 }
3072 
3074 {
3075  return E_NOTIMPL;
3076 }
3077 
3079 {
3080  return E_NOTIMPL;
3081 }
3082 
3084 {
3085  return E_NOTIMPL;
3086 }
3087 
3089 {
3090  return E_NOTIMPL;
3091 }
3092 
3094 {
3095  return E_NOTIMPL;
3096 }
3097 
3099 {
3100  return E_NOTIMPL;
3101 }
3102 
3104 {
3105  return E_NOTIMPL;
3106 }
3107 
3109 {
3110  return E_NOTIMPL;
3111 }
3112 
3114 {
3115  return E_NOTIMPL;
3116 }
3117 
3119 {
3120  return E_NOTIMPL;
3121 }
3122 
3124 {
3125  return E_NOTIMPL;
3126 }
3127 
3129 {
3130  return E_NOTIMPL;
3131 }
3132 
3134 {
3135  return E_NOTIMPL;
3136 }
3137 
3139 {
3140  return E_NOTIMPL;
3141 }
3142 
3144 {
3145  return E_NOTIMPL;
3146 }
3147 
3149 {
3150  return E_NOTIMPL;
3151 }
3152 
3154 {
3155  return E_NOTIMPL;
3156 }
3157 
3159 {
3160  return E_NOTIMPL;
3161 }
3162 
3164 {
3165  return E_NOTIMPL;
3166 }
3167 
3169 {
3170  return E_NOTIMPL;
3171 }
3172 
3174  VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3175 {
3176  LPITEMIDLIST pidl = NULL;
3177  HRESULT hResult;
3178  // called from drive combo box to navigate to a directory
3179  // Also called by search band to display shell results folder view
3180 
3181  if (V_VT(URL) == VT_BSTR)
3182  {
3183  return this->Navigate(V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
3184  }
3185  if (V_VT(URL) == (VT_ARRAY | VT_UI1))
3186  {
3187  if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
3188  return E_INVALIDARG;
3189 
3190  pidl = static_cast<LPITEMIDLIST>(V_ARRAY(URL)->pvData);
3191  }
3193  if (FAILED_UNEXPECTEDLY(hResult))
3194  return hResult;
3195  return S_OK;
3196 }
3197 
3199 {
3200  return E_NOTIMPL;
3201 }
3202 
3204  VARIANT *pvaIn, VARIANT *pvaOut)
3205 {
3206  return E_NOTIMPL;
3207 }
3208 
3210 {
3211  CLSID classID;
3212  bool vertical;
3213 
3214  // called to show search bar
3215  if (V_VT(pvaClsid) != VT_BSTR)
3216  return E_INVALIDARG;
3217  CLSIDFromString(V_BSTR(pvaClsid), &classID);
3218  // TODO: properly compute the value of vertical
3219  vertical = true;
3220  return ShowBand(classID, vertical);
3221 }
3222 
3224 {
3225  return E_NOTIMPL;
3226 }
3227 
3229 {
3230  return E_NOTIMPL;
3231 }
3232 
3234 {
3235  return E_NOTIMPL;
3236 }
3237 
3239 {
3240  return E_NOTIMPL;
3241 }
3242 
3244 {
3245  return E_NOTIMPL;
3246 }
3247 
3249 {
3250  return E_NOTIMPL;
3251 }
3252 
3254 {
3255  return E_NOTIMPL;
3256 }
3257 
3259 {
3260  return E_NOTIMPL;
3261 }
3262 
3264 {
3265  return E_NOTIMPL;
3266 }
3267 
3269 {
3270  return E_NOTIMPL;
3271 }
3272 
3274 {
3275  return E_NOTIMPL;
3276 }
3277 
3279 {
3280  return E_NOTIMPL;
3281 }
3282 
3284 {
3285  return E_NOTIMPL;
3286 }
3287 
3289 {
3290  return E_NOTIMPL;
3291 }
3292 
3294 {
3295  return E_NOTIMPL;
3296 }
3297 
3299 {
3300  return E_NOTIMPL;
3301 }
3302 
3304 {
3305  if (pWinData == NULL)
3306  return E_POINTER;
3307 
3308  pWinData->dwWindowID = -1;
3309  pWinData->uiCP = 0;
3310  pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
3311  pWinData->lpszUrl = NULL;
3312  pWinData->lpszUrlLocation = NULL;
3313  pWinData->lpszTitle = NULL;
3314  return S_OK;
3315 }
3316 
3318 {
3319  return E_NOTIMPL;
3320 }
3321 
3323 {
3324  return E_NOTIMPL;
3325 }
3326 
3328 {
3329  CComPtr<IPersistHistory> viewPersistHistory;
3330  CComPtr<IOleObject> viewHistoryObject;
3331  persistState oldState;
3332  ULONG numRead;
3333  LPITEMIDLIST pidl;
3334  HRESULT hResult;
3335 
3336  hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
3337  if (FAILED_UNEXPECTEDLY(hResult))
3338  return hResult;
3339  if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
3340  return E_FAIL;
3341  if (oldState.browseType != 2)
3342  return E_FAIL;
3343  pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
3344  if (pidl == NULL)
3345  return E_OUTOFMEMORY;
3346  hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
3347  if (FAILED_UNEXPECTEDLY(hResult))
3348  {
3349  ILFree(pidl);
3350  return hResult;
3351  }
3352  if (numRead != oldState.pidlSize)
3353  {
3354  ILFree(pidl);
3355  return E_FAIL;
3356  }
3357  hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
3358  IID_PPV_ARG(IOleObject, &viewHistoryObject));
3359  fHistoryObject = viewHistoryObject;
3360  fHistoryStream = pStream;
3361  fHistoryBindContext = pbc;
3362  hResult = BrowseToPIDL(pidl, BTP_DONT_UPDATE_HISTORY);
3363  fHistoryObject = NULL;
3364  fHistoryStream = NULL;
3366  ILFree(pidl);
3367  if (FAILED_UNEXPECTEDLY(hResult))
3368  return hResult;
3369  return S_OK;
3370 }
3371 
3373 {
3374  CComPtr<IPersistHistory> viewPersistHistory;
3375  persistState newState;
3376  HRESULT hResult;
3377 
3378  hResult = fCurrentShellView->GetItemObject(
3379  SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3380  memset(&newState, 0, sizeof(newState));
3381  newState.dwSize = sizeof(newState);
3382  newState.browseType = 2;
3383  newState.browserIndex = GetBrowserIndex();
3384  if (viewPersistHistory.p != NULL)
3385  {
3386  hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3387  if (FAILED_UNEXPECTEDLY(hResult))
3388  return hResult;
3389  }
3391  hResult = pStream->Write(&newState, sizeof(newState), NULL);
3392  if (FAILED_UNEXPECTEDLY(hResult))
3393  return hResult;
3394  hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3395  if (FAILED_UNEXPECTEDLY(hResult))
3396  return hResult;
3397  if (viewPersistHistory.p != NULL)
3398  {
3399  hResult = viewPersistHistory->SaveHistory(pStream);
3400  if (FAILED_UNEXPECTEDLY(hResult))
3401  return hResult;
3402  }
3403  return S_OK;
3404 }
3405 
3407 {
3408  return E_NOTIMPL;
3409 }
3410 
3412 {
3413  return E_NOTIMPL;
3414 }
3415 
3417 {
3418  OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3419  return 0;
3420 }
3421 
3423 {
3424  HRESULT hr;
3425 
3426  /* The current thread is about to go down so render any IDataObject that may be left in the clipboard */
3428 
3429  // TODO: rip down everything
3430  {
3432 
3433  fCurrentShellView->DestroyViewWindow();
3434  fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
3435 
3436  for (int i = 0; i < 3; i++)
3437  {
3439  CComPtr<IDeskBar> bar;
3440  CComPtr<IUnknown> pBarSite;
3441  CComPtr<IDeskBarClient> pClient;
3442 
3443  if (fClientBars[i].clientBar == NULL)
3444  continue;
3445 
3446  hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
3447  if (FAILED_UNEXPECTEDLY(hr))
3448  continue;
3449 
3450  /* We should destroy our basebarsite too */
3451  hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
3452  if (SUCCEEDED(hr))
3453  {
3454  hr = bar->GetClient(&pBarSite);
3455  if (SUCCEEDED(hr) && pBarSite)
3456  {
3457  hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
3458  if (SUCCEEDED(hr))
3459  pClient->SetDeskBarSite(NULL);
3460  }
3461  }
3462  pdw->CloseDW(0);
3463 
3464  pClient = NULL;
3465  pBarSite = NULL;
3466  pdw = NULL;
3467  bar = NULL;
3468  ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
3469  }
3470  ReleaseCComPtrExpectZero(fCurrentShellView);
3471  ReleaseCComPtrExpectZero(fTravelLog);
3472 
3477  }
3478  PostQuitMessage(0);
3479  return 0;
3480 }
3481 
3483 {
3484  CComPtr<IDockingWindow> dockingWindow;
3485  RECT availableBounds;
3486  static const INT excludeItems[] = {1, 1, 1, 0xa001, 0, 0};
3487  HRESULT hResult;
3488 
3489  if (wParam != SIZE_MINIMIZED)
3490  {
3491  GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3492  for (INT x = 0; x < 3; x++)
3493  {
3494  if (fClientBars[x].clientBar != NULL)
3495  {
3496  hResult = fClientBars[x].clientBar->QueryInterface(
3497  IID_PPV_ARG(IDockingWindow, &dockingWindow));
3498  if (SUCCEEDED(hResult) && dockingWindow != NULL)
3499  {
3500  hResult = dockingWindow->ResizeBorderDW(
3501  &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3502  break;
3503  }
3504  }
3505  }
3506  RepositionBars();
3507  }
3508  return 1;
3509 }
3510 
3512 {
3513  HMENU theMenu;
3514  LPARAM menuIndex = lParam;
3515 
3516  theMenu = reinterpret_cast<HMENU>(wParam);
3517 
3519  {
3520  menuIndex = 0;
3521  }
3522  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_EDIT))
3523  {
3524  menuIndex = 1;
3525  }
3526  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3527  {
3528  UpdateViewMenu(theMenu);
3529  menuIndex = 2;
3530  }
3532  {
3533  menuIndex = 3;
3534  }
3535  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_TOOLS))
3536  {
3537  // FIXME: Remove once implemented
3540  menuIndex = 4;
3541  }
3542  else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP))
3543  {
3544  menuIndex = 5;
3545  }
3546 
3547  LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
3548 
3549  return ret;
3550 }
3551 
3553 {
3555  return 0;
3556 }
3557 
3559 {
3562  return 0;
3563 }
3564 
3566 {
3567  LPVOID lpEnvironment;
3568  RegenerateUserEnvironment(&lpEnvironment, TRUE);
3569 
3571  return 0;
3572 }
3573 
3574 LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3575 {
3576  return SendMessage(WM_CLOSE);
3577 }
3578 
3579 LRESULT CShellBrowser::OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3580 {
3581  HRESULT hResult = DoFolderOptions();
3582  if (FAILED(hResult))
3583  TRACE("DoFolderOptions failed with hResult=%08lx\n", hResult);
3584  return 0;
3585 }
3586 
3587 LRESULT CShellBrowser::OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3588 {
3589 #ifndef __REACTOS__
3591 #endif /* __REACTOS__ */
3592  return 0;
3593 }
3594 
3595 LRESULT CShellBrowser::OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3596 {
3598  return 0;
3599 }
3600 
3601 LRESULT CShellBrowser::OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3602 {
3603  ShellAbout(m_hWnd, _T("ReactOS"), _T(""), NULL);
3604  return 0;
3605 }
3606 
3607 LRESULT CShellBrowser::OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3608 {
3609  HRESULT hResult = GoBack();
3610  if (FAILED(hResult))
3611  TRACE("GoBack failed with hResult=%08lx\n", hResult);
3612  return 0;
3613 }
3614 
3615 LRESULT CShellBrowser::OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3616 {
3617  HRESULT hResult = GoForward();
3618  if (FAILED(hResult))
3619  TRACE("GoForward failed with hResult=%08lx\n", hResult);
3620  return 0;
3621 }
3622 
3623 LRESULT CShellBrowser::OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3624 {
3625  HRESULT hResult = NavigateToParent();
3626  if (FAILED(hResult))
3627  TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3628  return 0;
3629 }
3630 
3631 LRESULT CShellBrowser::OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3632 {
3633  HRESULT hResult = GoHome();
3634  if (FAILED(hResult))
3635  TRACE("GoHome failed with hResult=%08lx\n", hResult);
3636  return 0;
3637 }
3638 
3639 LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3640 {
3641  // FIXME: This does not appear to be what windows does.
3642  HRESULT hResult = NavigateToParent();
3643  if (FAILED(hResult))
3644  TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3645  return 0;
3646 }
3647 
3648 LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3649 {
3650  CComPtr<IShellFolder> psfDesktop;
3651  LPITEMIDLIST pidlFavs;
3652  HRESULT hr;
3654  if (FAILED(hr))
3655  {
3657  if (FAILED(hr))
3658  return 0;
3659  }
3660 
3661  hr = SHGetDesktopFolder(&psfDesktop);
3662  if (FAILED_UNEXPECTEDLY(hr))
3663  return 0;
3664 
3665  hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
3666  if (FAILED_UNEXPECTEDLY(hr))
3667  return 0;
3668 
3669  return 0;
3670 }
3671 
3672 LRESULT CShellBrowser::OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3673 {
3675  if (fStatusBar)
3676  {
3678  RepositionBars();
3679  }
3680  return 0;
3681 }
3682 
3683 LRESULT CShellBrowser::OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3684 {
3685  HRESULT hResult;
3686  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3687  CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
3688  return 0;
3689 }
3690 
3692 {
3693  HRESULT hResult;
3694  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3695  CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
3696  return 0;
3697 }
3698 
3700 {
3701  HRESULT hResult;
3702  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3703  CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
3704  return 0;
3705 }
3706 
3707 LRESULT CShellBrowser::OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3708 {
3709  HRESULT hResult;
3710  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3711  CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
3712  return 0;
3713 }
3714 
3715 LRESULT CShellBrowser::OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3716 {
3717  HRESULT hResult;
3718  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3719  CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
3720  return 0;
3721 }
3722 
3723 LRESULT CShellBrowser::OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3724 {
3725  HRESULT hResult;
3726  hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3727  CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
3728  return 0;
3729 }
3730 
3731 LRESULT CShellBrowser::OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3732 {
3733  if (fCurrentShellView)
3734  fCurrentShellView->Refresh();
3735  return 0;
3736 }
3737 
3738 LRESULT CShellBrowser::OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3739 {
3740  return 0;
3741 }
3742 
3743 LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3744 {
3745  // TODO: HACK ! use the proper mechanism to show the band (i.e. pass the BSTR to basebar)
3747  {
3748  MenuBandInfo *mbi;
3750  if (!mbi)
3751  return 0;
3752  ShowBand(mbi->barGuid, mbi->fVertical);
3753  bHandled = TRUE;
3754  return 1;
3755  }
3756  switch (wID)
3757  {
3759  Exec(&CLSID_CommonButtons, 0x123, 1, NULL, NULL);
3760  break;
3762  ShowBand(CLSID_ExplorerBand, true);
3763  break;
3765  ShowBand(CLSID_SH_HistBand, true);
3766  break;
3768  ShowBand(CLSID_SH_FavBand, true);
3769  break;
3770  default:
3771  WARN("Unknown id %x\n", wID);
3772  }
3773  bHandled = TRUE;
3774  return 1;
3775 }
3776 
3778 {
3781  return 0;
3782 }
3783 
3785 {
3786  return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3787 }
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:1908
_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:1128
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:2492
#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:1939
#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:1897
#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:774
#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:2813
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)
Definition: