ReactOS 0.4.15-dev-7924-g5949c20
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)
 
HRESULT IEGetNameAndFlags (LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
 
BOOL CALLBACK AddFolderOptionsPage (HPROPSHEETPAGE thePage, LPARAM lParam)
 
bool IUnknownIsEqual (IUnknown *int1, IUnknown *int2)
 
static BOOL _ILIsNetworkPlace (LPCITEMIDLIST pidl)
 
static BOOL CreateShortcut (IN LPCWSTR pszLnkFileName, IN LPCITEMIDLIST pidl, IN LPCWSTR pszDescription OPTIONAL)
 
HRESULT GetFavsLocation (HWND hWnd, LPITEMIDLIST *pPidl)
 
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

◆ _ILIsNetworkPlace()

static BOOL _ILIsNetworkPlace ( LPCITEMIDLIST  pidl)
static

Definition at line 2369 of file shellbrowser.cpp.

2370{
2373}
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: ordinal.c:3464
BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
Definition: path.c:2266
LPCWSTR szPath
Definition: env.c:37
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CShellBrowser::GetPropertyBag().

◆ _ILIsPidlSimple()

BOOL WINAPI _ILIsPidlSimple ( LPCITEMIDLIST  pidl)

Definition at line 834 of file shellbrowser.cpp.

835{
836 LPCITEMIDLIST pidlnext;
837 WORD length;
838 BOOL ret;
839
840 ret = TRUE;
841 if (! _ILIsDesktop(pidl))
842 {
843 length = pidl->mkid.cb;
844 pidlnext =
845 reinterpret_cast<LPCITEMIDLIST>(
846 reinterpret_cast<const BYTE *>(pidl) + length);
847 if (pidlnext->mkid.cb != 0)
848 ret = FALSE;
849 }
850 return ret;
851}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
int ret
unsigned char BYTE
Definition: xxhash.c:193

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

◆ AddFolderOptionsPage()

BOOL CALLBACK AddFolderOptionsPage ( HPROPSHEETPAGE  thePage,
LPARAM  lParam 
)

Definition at line 1312 of file shellbrowser.cpp.

1313{
1314 PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1315 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1316 return FALSE;
1317 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1318 sheetInfo->nPages++;
1319 return TRUE;
1320}
LPARAM lParam
Definition: combotst.c:139
static const unsigned int folderOptionsPageCountMax
#define PROPSHEETHEADER
Definition: prsht.h:392

Referenced by CShellBrowser::DoFolderOptions().

◆ CreateProgressDialog()

HRESULT CreateProgressDialog ( REFIID  riid,
void **  ppv 
)

◆ CreateShortcut()

static BOOL CreateShortcut ( IN LPCWSTR  pszLnkFileName,
IN LPCITEMIDLIST  pidl,
IN LPCWSTR pszDescription  OPTIONAL 
)
static

Definition at line 3662 of file shellbrowser.cpp.

3666{
3667 IPersistFile *pPF;
3668 IShellLinkW *pSL;
3670 if (FAILED(hr))
3671 return hr;
3672
3673 hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3674 IID_IShellLinkW, (LPVOID*)&pSL);
3675 if (SUCCEEDED(hr))
3676 {
3677 pSL->SetIDList(pidl);
3678
3679 if (pszDescription)
3680 pSL->SetDescription(pszDescription);
3681
3682 hr = pSL->QueryInterface(IID_IPersistFile, (LPVOID*)&pPF);
3683 if (SUCCEEDED(hr))
3684 {
3685 hr = pPF->Save(pszLnkFileName, TRUE);
3686 pPF->Release();
3687 }
3688 pSL->Release();
3689 }
3690
3692
3693 return SUCCEEDED(hr);
3694}
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT SetIDList([in] PCIDLIST_ABSOLUTE pidl)
HRESULT SetDescription([in] LPCWSTR pszName)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
nsrefcnt Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const GUID IID_IPersistFile
HRESULT hr
Definition: shlfolder.c:183

Referenced by CShellBrowser::OnAddToFavorites().

◆ CShellBrowser_CreateInstance()

HRESULT CShellBrowser_CreateInstance ( REFIID  riid,
void **  ppv 
)

Definition at line 3905 of file shellbrowser.cpp.

3906{
3907 return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3908}
REFIID riid
Definition: atlbase.h:39
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 MIIM_ID
Definition: winuser.h:722
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_BYPOSITION
Definition: winuser.h:203
#define GetMenuItemInfo
Definition: winuser.h:5788

Referenced by CShellBrowser::UpdateGotoMenu().

◆ GetFavsLocation()

HRESULT GetFavsLocation ( HWND  hWnd,
LPITEMIDLIST pPidl 
)

Definition at line 3696 of file shellbrowser.cpp.

3697{
3699 if (FAILED(hr))
3701
3702 return hr;
3703}
HWND hWnd
Definition: settings.c:17
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3225
#define CSIDL_FAVORITES
Definition: shlobj.h:2164
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2188

Referenced by CShellBrowser::OnAddToFavorites(), and CShellBrowser::OnOrganizeFavorites().

◆ IEGetNameAndFlags()

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

Definition at line 922 of file shellbrowser.cpp.

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

Referenced by CShellBrowser::BrowseToPath(), CAddressEditBox::RefreshAddress(), and CShellBrowser::UpdateWindowTitle().

◆ IEGetNameAndFlagsEx()

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

Definition at line 890 of file shellbrowser.cpp.

892{
893 CComPtr<IShellFolder> parentFolder;
894 LPITEMIDLIST childPIDL = NULL;
895 STRRET L108;
896 HRESULT hResult;
897
898 hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
899 if (FAILED(hResult))
900 goto cleanup;
901
902 hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
903 if (FAILED(hResult))
904 goto cleanup;
905
906 StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
907 if (rgfInOut)
908 {
909 hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
910 if (FAILED(hResult))
911 goto cleanup;
912 }
913
914 hResult = S_OK;
915
916cleanup:
917 if (childPIDL)
918 ILFree(childPIDL);
919 return hResult;
920}
HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *unused, LPCITEMIDLIST pidl, const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
static void cleanup(void)
Definition: main.c:1335
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
#define S_OK
Definition: intsafe.h:52
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define IID_PPV_ARG(Itype, ppType)

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 FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121

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

◆ IUnknownIsEqual()

bool IUnknownIsEqual ( IUnknown int1,
IUnknown int2 
)

Definition at line 1862 of file shellbrowser.cpp.

1863{
1864 CComPtr<IUnknown> int1Retry;
1865 CComPtr<IUnknown> int2Retry;
1866 HRESULT hResult;
1867
1868 if (int1 == int2)
1869 return true;
1870 if (int1 == NULL || int2 == NULL)
1871 return false;
1872 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1873 if (FAILED_UNEXPECTEDLY(hResult))
1874 return false;
1875 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1876 if (FAILED_UNEXPECTEDLY(hResult))
1877 return false;
1878 if (int1Retry == int2Retry)
1879 return true;
1880 return false;
1881}
static BYTE int1[]
Definition: cert.c:3154
static BYTE int2[]
Definition: cert.c:3155

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);
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 WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define E_FAIL
Definition: ddrawi.h:102

Referenced by CShellBrowser::BrowseToPIDL().

◆ SHBindToFolderIDListParent()

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

Definition at line 853 of file shellbrowser.cpp.

855{
857 LPITEMIDLIST pidlChild;
858 LPITEMIDLIST pidlParent;
859 HRESULT hResult;
860
861 hResult = E_FAIL;
862 if (ppv == NULL)
863 return E_POINTER;
864 *ppv = NULL;
865 if (ppidlLast != NULL)
866 *ppidlLast = NULL;
867 if (_ILIsPidlSimple(pidl))
868 {
869 if (ppidlLast != NULL)
870 *ppidlLast = ILClone(pidl);
871 hResult = SHGetDesktopFolder((IShellFolder **)ppv);
872 }
873 else
874 {
875 pidlChild = ILClone(ILFindLastID(pidl));
876 pidlParent = ILClone(pidl);
877 ILRemoveLastID(pidlParent);
878 hResult = SHGetDesktopFolder(&psf);
879 if (SUCCEEDED(hResult))
880 hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
881 if (SUCCEEDED(hResult) && ppidlLast != NULL)
882 *ppidlLast = pidlChild;
883 else
884 ILFree(pidlChild);
885 ILFree(pidlParent);
886 }
887 return hResult;
888}
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:221
#define E_POINTER
Definition: winerror.h:2365

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().