ReactOS 0.4.15-dev-8434-g155a7c7
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 2490 of file shellbrowser.cpp.

2491{
2494}
#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 910 of file shellbrowser.cpp.

911{
912 LPCITEMIDLIST pidlnext;
913 WORD length;
914 BOOL ret;
915
916 ret = TRUE;
917 if (! _ILIsDesktop(pidl))
918 {
919 length = pidl->mkid.cb;
920 pidlnext =
921 reinterpret_cast<LPCITEMIDLIST>(
922 reinterpret_cast<const BYTE *>(pidl) + length);
923 if (pidlnext->mkid.cb != 0)
924 ret = FALSE;
925 }
926 return ret;
927}
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 1400 of file shellbrowser.cpp.

1401{
1402 PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1403 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1404 return FALSE;
1405 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1406 sheetInfo->nPages++;
1407 return TRUE;
1408}
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 3850 of file shellbrowser.cpp.

3854{
3855 IPersistFile *pPF;
3856 IShellLinkW *pSL;
3858 if (FAILED(hr))
3859 return hr;
3860
3861 hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3862 IID_IShellLinkW, (LPVOID*)&pSL);
3863 if (SUCCEEDED(hr))
3864 {
3865 pSL->SetIDList(pidl);
3866
3867 if (pszDescription)
3868 pSL->SetDescription(pszDescription);
3869
3870 hr = pSL->QueryInterface(IID_IPersistFile, (LPVOID*)&pPF);
3871 if (SUCCEEDED(hr))
3872 {
3873 hr = pPF->Save(pszLnkFileName, TRUE);
3874 pPF->Release();
3875 }
3876 pSL->Release();
3877 }
3878
3880
3881 return SUCCEEDED(hr);
3882}
#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 4099 of file shellbrowser.cpp.

4100{
4101 return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
4102}
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 3884 of file shellbrowser.cpp.

3885{
3887 if (FAILED(hr))
3889
3890 return hr;
3891}
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 998 of file shellbrowser.cpp.

999{
1000 return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
1001}
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 966 of file shellbrowser.cpp.

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

1947{
1948 CComPtr<IUnknown> int1Retry;
1949 CComPtr<IUnknown> int2Retry;
1950 HRESULT hResult;
1951
1952 if (int1 == int2)
1953 return true;
1954 if (int1 == NULL || int2 == NULL)
1955 return false;
1956 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1957 if (FAILED_UNEXPECTEDLY(hResult))
1958 return false;
1959 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1960 if (FAILED_UNEXPECTEDLY(hResult))
1961 return false;
1962 if (int1Retry == int2Retry)
1963 return true;
1964 return false;
1965}
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 929 of file shellbrowser.cpp.

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