ReactOS  0.4.15-dev-980-ge160524
shellbrowser.cpp File Reference
#include "precomp.h"
#include <shellapi.h>
#include <htiframe.h>
#include <strsafe.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 820 of file shellbrowser.cpp.

821 {
822  LPCITEMIDLIST pidlnext;
823  WORD length;
824  BOOL ret;
825 
826  ret = TRUE;
827  if (! _ILIsDesktop(pidl))
828  {
829  length = pidl->mkid.cb;
830  pidlnext =
831  reinterpret_cast<LPCITEMIDLIST>(
832  reinterpret_cast<const BYTE *>(pidl) + length);
833  if (pidlnext->mkid.cb != 0)
834  ret = FALSE;
835  }
836  return ret;
837 }
#define TRUE
Definition: types.h:120
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define FALSE
Definition: types.h:117
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 CFSFolder::GetDisplayNameOf(), CDrivesFolder::GetDisplayNameOf(), CDesktopFolder::GetDisplayNameOf(), HCR_GetFolderAttributes(), SHBindToFolderIDListParent(), and SHELL32_BindToSF().

◆ AddFolderOptionsPage()

BOOL CALLBACK AddFolderOptionsPage ( HPROPSHEETPAGE  thePage,
LPARAM  lParam 
)

Definition at line 1311 of file shellbrowser.cpp.

1312 {
1313  PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1314  if (sheetInfo->nPages >= folderOptionsPageCountMax)
1315  return FALSE;
1316  sheetInfo->phpage[sheetInfo->nPages] = thePage;
1317  sheetInfo->nPages++;
1318  return TRUE;
1319 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PROPSHEETHEADER
Definition: prsht.h:392
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 3774 of file shellbrowser.cpp.

3775 {
3776  return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3777 }
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 130 of file shellbrowser.cpp.

131 {
132  MENUITEMINFO menuItemInfo;
133  int menuItemCount;
134  int curIndex;
135 
136  menuItemCount = GetMenuItemCount(theMenu);
137  curIndex = 0;
138  while (curIndex < menuItemCount)
139  {
140  menuItemInfo.cbSize = sizeof(menuItemInfo);
141  menuItemInfo.fMask = MIIM_ID;
142  if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
143  menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
144  {
145  DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
146  menuItemCount--;
147  }
148  else
149  curIndex++;
150  }
151 }
#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:5763
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 908 of file shellbrowser.cpp.

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

Referenced by CShellBrowser::BrowseToPath().

◆ IEGetNameAndFlagsEx()

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

Definition at line 876 of file shellbrowser.cpp.

878 {
879  CComPtr<IShellFolder> parentFolder;
880  LPITEMIDLIST childPIDL = NULL;
881  STRRET L108;
882  HRESULT hResult;
883 
884  hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
885  if (FAILED(hResult))
886  goto cleanup;
887 
888  hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
889  if (FAILED(hResult))
890  goto cleanup;
891 
892  StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
893  if (rgfInOut)
894  {
895  hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
896  if (FAILED(hResult))
897  goto cleanup;
898  }
899 
900  hResult = S_OK;
901 
902 cleanup:
903  if (childPIDL)
904  ILFree(childPIDL);
905  return hResult;
906 }
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:59
#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:79
#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:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#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 1861 of file shellbrowser.cpp.

1862 {
1863  CComPtr<IUnknown> int1Retry;
1864  CComPtr<IUnknown> int2Retry;
1865  HRESULT hResult;
1866 
1867  if (int1 == int2)
1868  return true;
1869  if (int1 == NULL || int2 == NULL)
1870  return false;
1871  hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1872  if (FAILED_UNEXPECTEDLY(hResult))
1873  return false;
1874  hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1875  if (FAILED_UNEXPECTEDLY(hResult))
1876  return false;
1877  if (int1Retry == int2Retry)
1878  return true;
1879  return false;
1880 }
static BYTE int2[]
Definition: cert.c:3155
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
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 153 of file shellbrowser.cpp.

154 {
155  CComPtr<IShellFolder> desktop;
156 
157  HRESULT hr = ::SHGetDesktopFolder(&desktop);
158  if (FAILED_UNEXPECTEDLY(hr))
159  return E_FAIL;
160  if (path == NULL || path->mkid.cb == 0)
161  {
162  *newFolder = desktop;
163  desktop.p->AddRef ();
164  return S_OK;
165  }
166  return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
167 }
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:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
ULONG AddRef()
#define S_OK
Definition: intsafe.h:59

Referenced by CShellBrowser::BrowseToPIDL().

◆ SHBindToFolderIDListParent()

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

Definition at line 839 of file shellbrowser.cpp.

841 {
843  LPITEMIDLIST pidlChild;
844  LPITEMIDLIST pidlParent;
845  HRESULT hResult;
846 
847  hResult = E_FAIL;
848  if (ppv == NULL)
849  return E_POINTER;
850  *ppv = NULL;
851  if (ppidlLast != NULL)
852  *ppidlLast = NULL;
853  if (_ILIsPidlSimple(pidl))
854  {
855  if (ppidlLast != NULL)
856  *ppidlLast = ILClone(pidl);
857  hResult = SHGetDesktopFolder((IShellFolder **)ppv);
858  }
859  else
860  {
861  pidlChild = ILClone(ILFindLastID(pidl));
862  pidlParent = ILClone(pidl);
863  ILRemoveLastID(pidlParent);
864  hResult = SHGetDesktopFolder(&psf);
865  if (SUCCEEDED(hResult))
866  hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
867  if (SUCCEEDED(hResult) && ppidlLast != NULL)
868  *ppidlLast = pidlChild;
869  else
870  ILFree(pidlChild);
871  ILFree(pidlParent);
872  }
873  return hResult;
874 }
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:79
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 120 of file shellbrowser.cpp.

Referenced by CShellBrowser::LoadHistory().

◆ BTP_UPDATE_CUR_HISTORY

◆ BTP_UPDATE_NEXT_HISTORY

◆ createNewStuff

BOOL createNewStuff = false

Definition at line 124 of file shellbrowser.cpp.

◆ folderOptionsPageCountMax

const unsigned int folderOptionsPageCountMax = 20
static

Definition at line 119 of file shellbrowser.cpp.

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

◆ szCabinetWndClass

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

Definition at line 169 of file shellbrowser.cpp.

Referenced by CShellBrowser::GetWndClassInfo().