24 #define WIN32_NO_STATUS 27 #define NONAMELESSUNION 28 #define NONAMELESSSTRUCT 36 #include <wine/unicode.h> 48 #define SHV_CHANGE_NOTIFY (WM_USER + 0x1111) 105 #define LAYOUT_INFO_COUNT (sizeof(g_layout_info)/sizeof(g_layout_info[0])) 107 #define SUPPORTEDFLAGS (BIF_STATUSTEXT | \ 108 BIF_BROWSEFORCOMPUTER | \ 109 BIF_RETURNFSANCESTORS | \ 110 BIF_RETURNONLYFSDIRS | \ 111 BIF_NONEWFOLDERBUTTON | \ 112 BIF_NEWDIALOGSTYLE | \ 113 BIF_BROWSEINCLUDEFILES) 128 if (!lpBrowseInfo->
lpfn)
142 for (
i = 0;
i < layout_count;
i++)
148 ERR(
"Item %d not found\n",
i);
154 data[
i].width =
r.right -
r.left;
158 data[
i].height =
r.bottom -
r.top;
169 for (
i = 0;
i < layout_count;
i++)
180 if (!(layout_info[
i].dwAnchor &
BF_LEFT))
181 r.left =
r.right -
data[
i].width;
187 if (!(layout_info[
i].dwAnchor &
BF_TOP))
188 r.top =
r.bottom -
data[
i].height;
246 WARN(
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
251 hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (
LPVOID*)&lpsfParent);
252 IShellFolder_Release(lpsfDesktop);
256 WARN(
"Could not bind to parent shell folder! hr = %08x\n",
hr);
263 hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (
LPVOID*)&lpsfRoot);
265 lpsfRoot = lpsfParent;
266 hr = IShellFolder_AddRef(lpsfParent);
270 WARN(
"Could not bind to root shell folder! hr = %08x\n",
hr);
271 IShellFolder_Release(lpsfParent);
278 hr = IShellFolder_EnumObjects( lpsfRoot,
info->hWnd,
flags, &pEnumChildren );
280 WARN(
"Could not get child iterator! hr = %08x\n",
hr);
281 IShellFolder_Release(lpsfParent);
282 IShellFolder_Release(lpsfRoot);
290 pidlParent, pEnumChildren,
TVI_ROOT );
295 IShellFolder_Release(lpsfRoot);
296 IShellFolder_Release(lpsfParent);
311 TRACE(
"%p %p\n",lpifq, lpTV_ITEM);
349 TRACE(
"%p %p %x %p\n", lpsf, lpi,
dwFlags, lpFriendlyName);
388 if (!
GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
399 IShellFolder_AddRef(lpsf);
434 TRACE(
"%p %p %p %p\n",lpsf, pidl, hParent, lpe);
442 while (
S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
444 ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
447 IShellFolder_GetAttributesOf(lpsf, 1, (
LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
448 if (ulAttrs & SFGAO_FOLDER)
450 hr = IShellFolder_BindToObject(lpsf,pidlTemp,
NULL,&IID_IShellFolder,(
LPVOID*)&pSFChild);
454 hr = IShellFolder_EnumObjects(pSFChild,
hwnd,
flags, &pEnumIL);
457 if ((IEnumIDList_Skip(pEnumIL, 1) !=
S_OK) ||
458 FAILED(IEnumIDList_Reset(pEnumIL)))
460 IEnumIDList_Release(pEnumIL);
464 IShellFolder_Release(pSFChild);
468 if (ulAttrs != (ulAttrs & SFGAO_FOLDER))
509 dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
510 r = IShellFolder_GetAttributesOf(lptvid->
lpsfParent, 1,
517 r = IShellFolder_GetAttributesOf(lptvid->
lpsfParent, 1,
520 ((
dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
536 TRACE(
"TVN_DELETEITEMA/W %p\n", lptvid);
540 IEnumIDList_Release(lptvid->
pEnumIL);
553 TRACE(
"TVN_ITEMEXPANDINGA/W\n");
559 r = IShellFolder_BindToObject( lptvid->
lpsfParent, lptvid->
lpi, 0,
560 &IID_IShellFolder, (
void**)&lpsf2 );
563 IShellFolder_AddRef(lpsf2);
570 IShellFolder_Release( lpsf2 );
617 p = new_path+(
p-old_path+1);
657 item.hItem = selected_item;
660 ERR(
"TVM_GETITEMW failed\n");
668 ERR(
"SHGetPathFromIDListW failed\n");
672 fileop.
pFrom = szzFrom;
694 switch (keydown->
wVKey)
702 BrsFolder_Delete(
info, selected_item);
712 item.hItem = selected_item;
715 item_id = item_data->
lpi;
717 hr = IShellFolder_QueryInterface(item_data->
lpsfParent, &IID_ISFHelper, (
void**)&psfhlp);
722 ISFHelper_DeleteItems(psfhlp, 1, &item_id);
723 ISFHelper_Release(psfhlp);
780 FIXME(
"flags BIF_NEWDIALOGSTYLE partially implemented\n");
797 RECT rcEdit, rcTreeView;
803 rcTreeView.top -=
cy;
805 rcTreeView.left, rcTreeView.top,
806 rcTreeView.right - rcTreeView.left,
807 rcTreeView.bottom - rcTreeView.top,
TRUE);
853 if (
info->hwndTreeView)
870 ERR(
"treeview control missing!\n");
875 ntreg.
pidl = computer_pidl;
899 WCHAR wszNewFolder[25];
919 hr = IShellFolder_BindToObject(desktop,
info->pidlRet, 0, &IID_IShellFolder, (
void**)&
cur);
920 IShellFolder_Release(desktop);
945 ERR(
"Make new folder button should be disabled\n");
954 hr = IShellFolder_BindToObject(desktop,
info->pidlRet, 0, &IID_IShellFolder, (
void**)&
cur);
955 IShellFolder_Release(desktop);
959 hr = IShellFolder_QueryInterface(
cur, &IID_ISFHelper, (
void**)&sfhelper);
972 ISFHelper_Release(sfhelper);
997 IEnumIDList_Release(item_data->
pEnumIL);
1015 IShellFolder_Release(
cur);
1089 hr = IShellFolder_ParseDisplayName(psfDesktop,
NULL,
NULL,
1091 IShellFolder_Release(psfDesktop);
1106 pidlRoot =
info->lpBrowseInfo->pidlRoot;
1107 pidlCurrent = pidlSelection;
1151 if (pidlSelection && pidlSelection !=
selection)
1155 *pItem =
item.hItem;
1258 TRACE(
"(%p)->(%p, %p, 0x%08x)\n",
info, pidls[0], pidls[1],
event);
1364 TRACE(
"%p\n", lpbi);
1414 const WCHAR * templateName;
1420 info.lpBrowseInfo = lpbi;
1426 icex.
dwSize =
sizeof( icex );
1451 return info.pidlRet;
WINE_DEFAULT_DEBUG_CHANNEL(shell)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
#define IDC_BROWSE_FOR_FOLDER_STATUS
struct tagLAYOUT_DATA LAYOUT_DATA
#define SHGFI_SYSICONINDEX
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
void WINAPI ILFree(LPITEMIDLIST pidl)
LPITEMIDLIST _ILCreateDesktop(void)
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WideCharToMultiByte
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
struct tagTV_ITEMDATA * LPTV_ITEMDATA
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
GLdouble GLdouble GLdouble r
#define LAYOUT_INFO_COUNT
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
struct _TREEITEM * HTREEITEM
#define BIF_BROWSEINCLUDEFILES
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
#define BFFM_SETSELECTIONA
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define BIF_NONEWFOLDERBUTTON
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
#define TVIS_EXPANDEDONCE
#define TVIF_SELECTEDIMAGE
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagLAYOUT_INFO LAYOUT_INFO
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
#define IDC_BROWSE_FOR_FOLDER_TITLE
#define TreeView_InsertItem(hwnd, lpis)
#define TVN_ENDLABELEDITW
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
#define ICC_TREEVIEW_CLASSES
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
static struct _test_info info[]
GLenum GLuint GLenum GLsizei length
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
#define BIF_RETURNFSANCESTORS
_Out_opt_ int _Out_opt_ int * cy
#define SHCNRF_InterruptLevel
struct tagMINMAXINFO * LPMINMAXINFO
#define SHV_CHANGE_NOTIFY
#define BFFM_SETSELECTIONW
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
#define IDD_BROWSE_FOR_FOLDER
#define TVN_ITEMEXPANDINGW
#define IDC_BROWSE_FOR_FOLDER_FOLDER
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define BIF_NEWDIALOGSTYLE
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
#define TVN_ENDLABELEDITA
LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi)
#define WM_WINDOWPOSCHANGING
PCIDLIST_ABSOLUTE pidlRoot
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
static HRESULT BrsFolder_NewFolder(browse_info *info)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
#define memcpy(s1, s2, n)
PCIDLIST_ABSOLUTE pidlRoot
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
#define IDD_BROWSE_FOR_FOLDER_NEW
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
HWND WINAPI SetCapture(_In_ HWND hWnd)
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
#define shell32_hInstance
static INT BrsFolder_OnDestroy(browse_info *info)
#define BIF_RETURNONLYFSDIRS
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
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
void shell(int argc, const char *argv[])
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
static void InitializeTreeView(browse_info *info)
void pdump(LPCITEMIDLIST pidl)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BFFM_SETSTATUSTEXTA
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
#define MultiByteToWideChar
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
void WINAPI SHFree(LPVOID pv)
BOOL WINAPI ReleaseCapture(void)
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
LPBROWSEINFOW lpBrowseInfo
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
char * cleanup(char *str)
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SHACF_FILESYS_ONLY
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
#define MAKEINTRESOURCEW(i)
#define CSIDL_DESKTOPDIRECTORY
GLuint GLuint GLsizei GLenum type
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
#define BFFM_SETSTATUSTEXTW
#define BIF_BROWSEFORCOMPUTER
static const LAYOUT_INFO g_layout_info[]
LPVOID WINAPI SHAlloc(SIZE_T len)
#define HeapFree(x, y, z)
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
struct tagbrowse_info browse_info
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
#define TVN_ITEMEXPANDINGA
struct tagTV_ITEMDATA TV_ITEMDATA