ReactOS  0.4.13-dev-698-g77671f0
shellbrowser.cpp File Reference
#include "precomp.h"
#include <shellapi.h>
#include <htiframe.h>
#include <strsafe.h>
#include <undocshell.h>
#include "newatlinterfaces.h"
Include dependency graph for shellbrowser.cpp:

Go to the source code of this file.

Classes

class  CToolbarProxy
 
struct  MenuBandInfo
 
class  CShellBrowser
 
class  CShellBrowser::barInfo
 

Functions

HRESULT IUnknown_ShowDW (IUnknown *punk, BOOL fShow)
 
void DeleteMenuItems (HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
 
HRESULT WINAPI SHBindToFolder (LPCITEMIDLIST path, IShellFolder **newFolder)
 
HRESULT CreateProgressDialog (REFIID riid, void **ppv)
 
BOOL WINAPI _ILIsPidlSimple (LPCITEMIDLIST pidl)
 
HRESULT WINAPI SHBindToFolderIDListParent (IShellFolder *unused, LPCITEMIDLIST pidl, const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
 
HRESULT IEGetNameAndFlagsEx (LPITEMIDLIST pidl, SHGDNF uFlags, long param10, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
 
long IEGetNameAndFlags (LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
 
BOOL CALLBACK AddFolderOptionsPage (HPROPSHEETPAGE thePage, LPARAM lParam)
 
bool IUnknownIsEqual (IUnknown *int1, IUnknown *int2)
 
HRESULT CShellBrowser_CreateInstance (REFIID riid, void **ppv)
 

Variables

static const unsigned int folderOptionsPageCountMax = 20
 
static const long BTP_DONT_UPDATE_HISTORY = 0
 
static const long BTP_UPDATE_CUR_HISTORY = 1
 
static const long BTP_UPDATE_NEXT_HISTORY = 2
 
BOOL createNewStuff = false
 
static const TCHAR szCabinetWndClass [] = TEXT("CabinetWClass")
 

Function Documentation

◆ _ILIsPidlSimple()

BOOL WINAPI _ILIsPidlSimple ( LPCITEMIDLIST  pidl)

Definition at line 821 of file shellbrowser.cpp.

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 }
#define TRUE
Definition: types.h:120
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned short WORD
Definition: ntddk_ex.h:93
int ret

Referenced by CDrivesFolder::GetDisplayNameOf(), CDesktopFolder::GetDisplayNameOf(), CFSFolder::GetDisplayNameOf(), HCR_GetFolderAttributes(), SHBindToFolderIDListParent(), and SHELL32_BindToSF().

◆ AddFolderOptionsPage()

BOOL CALLBACK AddFolderOptionsPage ( HPROPSHEETPAGE  thePage,
LPARAM  lParam 
)

Definition at line 1305 of file shellbrowser.cpp.

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 }
#define TRUE
Definition: types.h:120
#define PROPSHEETHEADER
Definition: prsht.h:374
static const unsigned int folderOptionsPageCountMax
LPARAM lParam
Definition: combotst.c:139

Referenced by CShellBrowser::DoFolderOptions().

◆ CreateProgressDialog()

HRESULT CreateProgressDialog ( REFIID  riid,
void **  ppv 
)

◆ CShellBrowser_CreateInstance()

HRESULT CShellBrowser_CreateInstance ( REFIID  riid,
void **  ppv 
)

Definition at line 3784 of file shellbrowser.cpp.

3785 {
3786  return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3787 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by ExplorerMessageLoop().

◆ DeleteMenuItems()

void DeleteMenuItems ( HMENU  theMenu,
unsigned int  firstIDToDelete,
unsigned int  lastIDToDelete 
)

Definition at line 131 of file shellbrowser.cpp.

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 }
#define TRUE
Definition: types.h:120
#define MF_BYPOSITION
Definition: winuser.h:203
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define MIIM_ID
Definition: winuser.h:717
#define GetMenuItemInfo
Definition: winuser.h:5686
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)

Referenced by CShellBrowser::UpdateGotoMenu().

◆ IEGetNameAndFlags()

long IEGetNameAndFlags ( LPITEMIDLIST  pidl,
SHGDNF  uFlags,
LPWSTR  pszBuf,
UINT  cchBuf,
SFGAOF rgfInOut 
)

Definition at line 909 of file shellbrowser.cpp.

910 {
911  return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
912 }
HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
UINT uFlags
Definition: api.c:60

Referenced by CShellBrowser::BrowseToPath().

◆ IEGetNameAndFlagsEx()

HRESULT IEGetNameAndFlagsEx ( LPITEMIDLIST  pidl,
SHGDNF  uFlags,
long  param10,
LPWSTR  pszBuf,
UINT  cchBuf,
SFGAOF rgfInOut 
)

Definition at line 877 of file shellbrowser.cpp.

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 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
UINT uFlags
Definition: api.c:60
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *unused, LPCITEMIDLIST pidl, const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
char * cleanup(char *str)
Definition: wpickclick.c:99
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by IEGetNameAndFlags().

◆ IUnknown_ShowDW()

HRESULT IUnknown_ShowDW ( IUnknown punk,
BOOL  fShow 
)

Definition at line 92 of file internettoolbar.cpp.

93 {
94  CComPtr<IDockingWindow> dockingWindow;
95  HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
96  if (FAILED_UNEXPECTEDLY(hResult))
97  return hResult;
98  hResult = dockingWindow->ShowDW(fShow);
99  if (FAILED_UNEXPECTEDLY(hResult))
100  return hResult;
101  return S_OK;
102 }
#define IID_PPV_ARG(Itype, ppType)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
#define S_OK
Definition: intsafe.h:59
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by CShellBrowser::Exec(), CShellBrowser::Initialize(), and CInternetToolbar::ShowDW().

◆ IUnknownIsEqual()

bool IUnknownIsEqual ( IUnknown int1,
IUnknown int2 
)

Definition at line 1855 of file shellbrowser.cpp.

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 }
static BYTE int2[]
Definition: cert.c:3155
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
static BYTE int1[]
Definition: cert.c:3154

Referenced by CShellBrowser::Exec(), CShellBrowser::GetBorderDW(), and CShellBrowser::SetBorderSpaceDW().

◆ SHBindToFolder()

HRESULT WINAPI SHBindToFolder ( LPCITEMIDLIST  path,
IShellFolder **  newFolder 
)

Definition at line 154 of file shellbrowser.cpp.

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 }
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
ULONG AddRef()
#define S_OK
Definition: intsafe.h:59
Definition: services.c:325

Referenced by CShellBrowser::BrowseToPIDL().

◆ SHBindToFolderIDListParent()

HRESULT WINAPI SHBindToFolderIDListParent ( IShellFolder unused,
LPCITEMIDLIST  pidl,
const IID riid,
LPVOID ppv,
LPITEMIDLIST ppidlLast 
)

Definition at line 840 of file shellbrowser.cpp.

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 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:77
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define E_POINTER
Definition: winerror.h:2365
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IEGetNameAndFlagsEx().

Variable Documentation

◆ BTP_DONT_UPDATE_HISTORY

const long BTP_DONT_UPDATE_HISTORY = 0
static

Definition at line 121 of file shellbrowser.cpp.

Referenced by CShellBrowser::LoadHistory().

◆ BTP_UPDATE_CUR_HISTORY

◆ BTP_UPDATE_NEXT_HISTORY

◆ createNewStuff

BOOL createNewStuff = false

Definition at line 125 of file shellbrowser.cpp.

◆ folderOptionsPageCountMax

const unsigned int folderOptionsPageCountMax = 20
static

Definition at line 120 of file shellbrowser.cpp.

Referenced by AddFolderOptionsPage(), and CShellBrowser::DoFolderOptions().

◆ szCabinetWndClass

const TCHAR szCabinetWndClass[] = TEXT("CabinetWClass")
static

Definition at line 170 of file shellbrowser.cpp.

Referenced by CShellBrowser::GetWndClassInfo().