24#define WIN32_NO_STATUS
27#define NONAMELESSUNION
28#define NONAMELESSSTRUCT
36#include <wine/unicode.h>
49#define SHV_CHANGE_NOTIFY (WM_USER + 0x1111)
106#define LAYOUT_INFO_COUNT (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
108#define SUPPORTEDFLAGS (BIF_STATUSTEXT | \
109 BIF_BROWSEFORCOMPUTER | \
110 BIF_RETURNFSANCESTORS | \
111 BIF_RETURNONLYFSDIRS | \
112 BIF_NONEWFOLDERBUTTON | \
113 BIF_NEWDIALOGSTYLE | \
114 BIF_BROWSEINCLUDEFILES)
129 if (!lpBrowseInfo->
lpfn)
143 for (
i = 0;
i < layout_count;
i++)
149 ERR(
"Item %d not found\n",
i);
155 data[
i].width =
r.right -
r.left;
159 data[
i].height =
r.bottom -
r.top;
170 for (
i = 0;
i < layout_count;
i++)
181 if (!(layout_info[
i].dwAnchor &
BF_LEFT))
182 r.left =
r.right -
data[
i].width;
188 if (!(layout_info[
i].dwAnchor &
BF_TOP))
189 r.top =
r.bottom -
data[
i].height;
247 WARN(
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
252 hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (
LPVOID*)&lpsfParent);
253 IShellFolder_Release(lpsfDesktop);
257 WARN(
"Could not bind to parent shell folder! hr = %08x\n",
hr);
264 hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (
LPVOID*)&lpsfRoot);
266 lpsfRoot = lpsfParent;
267 hr = IShellFolder_AddRef(lpsfParent);
271 WARN(
"Could not bind to root shell folder! hr = %08x\n",
hr);
272 IShellFolder_Release(lpsfParent);
279 hr = IShellFolder_EnumObjects( lpsfRoot,
info->hWnd,
flags, &pEnumChildren );
281 WARN(
"Could not get child iterator! hr = %08x\n",
hr);
282 IShellFolder_Release(lpsfParent);
283 IShellFolder_Release(lpsfRoot);
291 pidlParent, pEnumChildren,
TVI_ROOT );
296 IShellFolder_Release(lpsfRoot);
297 IShellFolder_Release(lpsfParent);
312 TRACE(
"%p %p\n",lpifq, lpTV_ITEM);
350 TRACE(
"%p %p %x %p\n", lpsf, lpi,
dwFlags, lpFriendlyName);
389 if (!
GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
400 IShellFolder_AddRef(lpsf);
435 TRACE(
"%p %p %p %p\n",lpsf, pidl, hParent, lpe);
443 while (
S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
445 ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
448 IShellFolder_GetAttributesOf(lpsf, 1, (
LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
449 if (ulAttrs & SFGAO_FOLDER)
451 hr = IShellFolder_BindToObject(lpsf,pidlTemp,
NULL,&IID_IShellFolder,(
LPVOID*)&pSFChild);
455 hr = IShellFolder_EnumObjects(pSFChild,
hwnd,
flags, &pEnumIL);
458 if ((IEnumIDList_Skip(pEnumIL, 1) !=
S_OK) ||
459 FAILED(IEnumIDList_Reset(pEnumIL)))
461 IEnumIDList_Release(pEnumIL);
465 IShellFolder_Release(pSFChild);
469 if (ulAttrs != (ulAttrs & SFGAO_FOLDER))
510 dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
511 r = IShellFolder_GetAttributesOf(lptvid->
lpsfParent, 1,
518 r = IShellFolder_GetAttributesOf(lptvid->
lpsfParent, 1,
521 ((
dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
537 TRACE(
"TVN_DELETEITEMA/W %p\n", lptvid);
541 IEnumIDList_Release(lptvid->
pEnumIL);
554 TRACE(
"TVN_ITEMEXPANDINGA/W\n");
560 r = IShellFolder_BindToObject( lptvid->
lpsfParent, lptvid->
lpi, 0,
561 &IID_IShellFolder, (
void**)&lpsf2 );
564 IShellFolder_AddRef(lpsf2);
571 IShellFolder_Release( lpsf2 );
618 p = new_path+(
p-old_path+1);
658 item.hItem = selected_item;
661 ERR(
"TVM_GETITEMW failed\n");
669 ERR(
"SHGetPathFromIDListW failed\n");
673 fileop.
pFrom = szzFrom;
695 switch (keydown->
wVKey)
703 BrsFolder_Delete(
info, selected_item);
713 item.hItem = selected_item;
716 item_id = item_data->
lpi;
718 hr = IShellFolder_QueryInterface(item_data->
lpsfParent, &IID_ISFHelper, (
void**)&psfhlp);
723 ISFHelper_DeleteItems(psfhlp, 1, &item_id);
724 ISFHelper_Release(psfhlp);
781 FIXME(
"flags BIF_NEWDIALOGSTYLE partially implemented\n");
798 RECT rcEdit, rcTreeView;
804 rcTreeView.
top -=
cy;
806 rcTreeView.
left, rcTreeView.
top,
854 if (
info->hwndTreeView)
871 ERR(
"treeview control missing!\n");
876 ntreg.
pidl = computer_pidl;
900 WCHAR wszNewFolder[25];
920 hr = IShellFolder_BindToObject(desktop,
info->pidlRet, 0, &IID_IShellFolder, (
void**)&
cur);
921 IShellFolder_Release(desktop);
946 ERR(
"Make new folder button should be disabled\n");
955 hr = IShellFolder_BindToObject(desktop,
info->pidlRet, 0, &IID_IShellFolder, (
void**)&
cur);
956 IShellFolder_Release(desktop);
960 hr = IShellFolder_QueryInterface(
cur, &IID_ISFHelper, (
void**)&sfhelper);
973 ISFHelper_Release(sfhelper);
998 IEnumIDList_Release(item_data->
pEnumIL);
1016 IShellFolder_Release(
cur);
1102 hr = IShellFolder_ParseDisplayName(psfDesktop,
NULL,
NULL,
1104 IShellFolder_Release(psfDesktop);
1119 pidlRoot =
info->lpBrowseInfo->pidlRoot;
1120 pidlCurrent = pidlSelection;
1164 if (pidlSelection && pidlSelection !=
selection)
1168 *pItem =
item.hItem;
1271 TRACE(
"(%p)->(%p, %p, 0x%08x)\n",
info, pidls[0], pidls[1],
event);
1377 TRACE(
"%p\n", lpbi);
1427 const WCHAR * templateName;
1433 info.lpBrowseInfo = lpbi;
1439 icex.
dwSize =
sizeof( icex );
1464 return info.pidlRet;
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define shell32_hInstance
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void shell(int argc, const char *argv[])
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
void pdump(LPCITEMIDLIST pidl)
#define HeapFree(x, y, z)
#define WideCharToMultiByte
#define MultiByteToWideChar
static void cleanup(void)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
struct tagTV_ITEMDATA TV_ITEMDATA
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
#define LAYOUT_INFO_COUNT
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
static INT BrsFolder_OnDestroy(browse_info *info)
struct tagLAYOUT_INFO LAYOUT_INFO
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi)
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
static const LAYOUT_INFO g_layout_info[]
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
#define SHV_CHANGE_NOTIFY
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
static void InitializeTreeView(browse_info *info)
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
static HRESULT BrsFolder_NewFolder(browse_info *info)
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
struct tagbrowse_info browse_info
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
struct tagLAYOUT_DATA LAYOUT_DATA
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
void WINAPI SHFree(LPVOID pv)
LPVOID WINAPI SHAlloc(SIZE_T len)
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
#define memcpy(s1, s2, n)
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
void WINAPI ILFree(LPITEMIDLIST pidl)
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
LPITEMIDLIST _ILCreateDesktop(void)
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
#define TVN_ENDLABELEDITA
_Out_opt_ int _Out_opt_ int * cy
#define ICC_TREEVIEW_CLASSES
#define TVN_ITEMEXPANDINGA
#define TVIS_EXPANDEDONCE
struct _TREEITEM * HTREEITEM
#define TVN_ITEMEXPANDINGW
#define TreeView_InsertItem(hwnd, lpis)
#define TVIF_SELECTEDIMAGE
#define TVN_ENDLABELEDITW
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
#define SHGFI_SYSICONINDEX
#define SHGFI_DISPLAYNAME
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
#define CSIDL_DESKTOPDIRECTORY
#define BIF_RETURNONLYFSDIRS
#define BIF_RETURNFSANCESTORS
#define BFFM_SETSELECTIONW
#define BIF_BROWSEINCLUDEFILES
#define BFFM_SETSTATUSTEXTW
#define SHCNRF_InterruptLevel
#define BFFM_SETSTATUSTEXTA
#define BIF_NONEWFOLDERBUTTON
#define BIF_NEWDIALOGSTYLE
#define BIF_BROWSEFORCOMPUTER
#define BFFM_SETSELECTIONA
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
#define SHACF_FILESYS_ONLY
#define IDD_BROWSE_FOR_FOLDER_NEW
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
#define IDD_BROWSE_FOR_FOLDER
#define IDC_BROWSE_FOR_FOLDER_STATUS
#define IDC_BROWSE_FOR_FOLDER_TITLE
#define IDC_BROWSE_FOR_FOLDER_FOLDER
ITEMIDLIST UNALIGNED * LPITEMIDLIST
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
WCHAR szDisplayName[MAX_PATH]
PCIDLIST_ABSOLUTE pidlRoot
PCIDLIST_ABSOLUTE pidlRoot
LPBROWSEINFOW lpBrowseInfo
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
#define WM_WINDOWPOSCHANGING
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
struct tagMINMAXINFO * LPMINMAXINFO
#define MAKEINTRESOURCEW(i)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)