ReactOS 0.4.15-dev-8408-g466a198
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
 
static const long BTP_ACTIVATE_NOFOCUS = 0x04
 
BOOL createNewStuff = false
 
static const TCHAR szCabinetWndClass [] = TEXT("CabinetWClass")
 

Function Documentation

◆ _ILIsNetworkPlace()

static BOOL _ILIsNetworkPlace ( LPCITEMIDLIST  pidl)
static

Definition at line 2473 of file shellbrowser.cpp.

2474{
2477}
#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 905 of file shellbrowser.cpp.

906{
907 LPCITEMIDLIST pidlnext;
908 WORD length;
909 BOOL ret;
910
911 ret = TRUE;
912 if (! _ILIsDesktop(pidl))
913 {
914 length = pidl->mkid.cb;
915 pidlnext =
916 reinterpret_cast<LPCITEMIDLIST>(
917 reinterpret_cast<const BYTE *>(pidl) + length);
918 if (pidlnext->mkid.cb != 0)
919 ret = FALSE;
920 }
921 return ret;
922}
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 CFSFolder::CompareIDs(), CDesktopFolder::GetDisplayNameOf(), CDrivesFolder::GetDisplayNameOf(), CFSFolder::GetDisplayNameOf(), HCR_GetFolderAttributes(), SHBindToFolderIDListParent(), and SHELL32_BindToSF().

◆ AddFolderOptionsPage()

BOOL CALLBACK AddFolderOptionsPage ( HPROPSHEETPAGE  thePage,
LPARAM  lParam 
)

Definition at line 1384 of file shellbrowser.cpp.

1385{
1386 PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1387 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1388 return FALSE;
1389 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1390 sheetInfo->nPages++;
1391 return TRUE;
1392}
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 3832 of file shellbrowser.cpp.

3836{
3837 IPersistFile *pPF;
3838 IShellLinkW *pSL;
3840 if (FAILED(hr))
3841 return hr;
3842
3843 hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3844 IID_IShellLinkW, (LPVOID*)&pSL);
3845 if (SUCCEEDED(hr))
3846 {
3847 pSL->SetIDList(pidl);
3848
3849 if (pszDescription)
3850 pSL->SetDescription(pszDescription);
3851
3852 hr = pSL->QueryInterface(IID_IPersistFile, (LPVOID*)&pPF);
3853 if (SUCCEEDED(hr))
3854 {
3855 hr = pPF->Save(pszLnkFileName, TRUE);
3856 pPF->Release();
3857 }
3858 pSL->Release();
3859 }
3860
3862
3863 return SUCCEEDED(hr);
3864}
#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 4081 of file shellbrowser.cpp.

4082{
4083 return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
4084}
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 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 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:5797

Referenced by CShellBrowser::UpdateGotoMenu().

◆ GetFavsLocation()

HRESULT GetFavsLocation ( HWND  hWnd,
LPITEMIDLIST pPidl 
)

Definition at line 3866 of file shellbrowser.cpp.

3867{
3869 if (FAILED(hr))
3871
3872 return hr;
3873}
HWND hWnd
Definition: settings.c:17
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3260
#define CSIDL_FAVORITES
Definition: shlobj.h:2178
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2202

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

◆ IEGetNameAndFlags()

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

Definition at line 993 of file shellbrowser.cpp.

994{
995 return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
996}
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 961 of file shellbrowser.cpp.

963{
964 CComPtr<IShellFolder> parentFolder;
965 LPITEMIDLIST childPIDL = NULL;
966 STRRET L108;
967 HRESULT hResult;
968
969 hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
970 if (FAILED(hResult))
971 goto cleanup;
972
973 hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
974 if (FAILED(hResult))
975 goto cleanup;
976
977 StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
978 if (rgfInOut)
979 {
980 hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
981 if (FAILED(hResult))
982 goto cleanup;
983 }
984
985 hResult = S_OK;
986
987cleanup:
988 if (childPIDL)
989 ILFree(childPIDL);
990 return hResult;
991}
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:940
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 105 of file internettoolbar.cpp.

106{
107 CComPtr<IDockingWindow> dockingWindow;
108 HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
109 if (FAILED_UNEXPECTEDLY(hResult))
110 return hResult;
111 hResult = dockingWindow->ShowDW(fShow);
112 if (FAILED_UNEXPECTEDLY(hResult))
113 return hResult;
114 return S_OK;
115}
#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 1930 of file shellbrowser.cpp.

1931{
1932 CComPtr<IUnknown> int1Retry;
1933 CComPtr<IUnknown> int2Retry;
1934 HRESULT hResult;
1935
1936 if (int1 == int2)
1937 return true;
1938 if (int1 == NULL || int2 == NULL)
1939 return false;
1940 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1941 if (FAILED_UNEXPECTEDLY(hResult))
1942 return false;
1943 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1944 if (FAILED_UNEXPECTEDLY(hResult))
1945 return false;
1946 if (int1Retry == int2Retry)
1947 return true;
1948 return false;
1949}
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 154 of file shellbrowser.cpp.

155{
156 CComPtr<IShellFolder> desktop;
157
158 HRESULT hr = ::SHGetDesktopFolder(&desktop);
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 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 924 of file shellbrowser.cpp.

926{
928 LPITEMIDLIST pidlChild;
929 LPITEMIDLIST pidlParent;
930 HRESULT hResult;
931
932 hResult = E_FAIL;
933 if (ppv == NULL)
934 return E_POINTER;
935 *ppv = NULL;
936 if (ppidlLast != NULL)
937 *ppidlLast = NULL;
938 if (_ILIsPidlSimple(pidl))
939 {
940 if (ppidlLast != NULL)
941 *ppidlLast = ILClone(pidl);
942 hResult = SHGetDesktopFolder((IShellFolder **)ppv);
943 }
944 else
945 {
946 pidlChild = ILClone(ILFindLastID(pidl));
947 pidlParent = ILClone(pidl);
948 ILRemoveLastID(pidlParent);
949 hResult = SHGetDesktopFolder(&psf);
950 if (SUCCEEDED(hResult))
951 hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
952 if (SUCCEEDED(hResult) && ppidlLast != NULL)
953 *ppidlLast = pidlChild;
954 else
955 ILFree(pidlChild);
956 ILFree(pidlParent);
957 }
958 return hResult;
959}
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_ACTIVATE_NOFOCUS

const long BTP_ACTIVATE_NOFOCUS = 0x04
static

Definition at line 123 of file shellbrowser.cpp.

Referenced by CShellBrowser::BrowseObject(), and CShellBrowser::BrowseToPath().

◆ 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 125 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 170 of file shellbrowser.cpp.

Referenced by CShellBrowser::GetWndClassInfo().