ReactOS  0.4.15-dev-1201-gb2cf5a4
brsfolder.c
Go to the documentation of this file.
1 /*
2  * Copyright 1999 Juergen Schmied
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  *
18  * FIXME:
19  * - many memory leaks
20  * - many flags unimplemented
21  * - implement editbox
22  */
23 
24 #define WIN32_NO_STATUS
25 #define _INC_WINDOWS
26 #define COBJMACROS
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
29 
30 #include <windef.h>
31 #include <winbase.h>
32 #include <shlobj.h>
33 #include <undocshell.h>
34 #include <shellapi.h>
35 #include <wine/debug.h>
36 #include <wine/unicode.h>
37 
38 #include "pidl.h"
39 #include "shell32_main.h"
40 #include "shresdef.h"
41 #ifdef __REACTOS__
42  #include <shlwapi.h>
43  #include "layout.h" /* Resizable window */
44 #endif
45 
47 
48 #define SHV_CHANGE_NOTIFY (WM_USER + 0x1111)
49 
50 #ifndef __REACTOS__ /* Defined in "layout.h" */
51 /* original margins and control size */
52 typedef struct tagLAYOUT_DATA
53 {
56 } LAYOUT_DATA;
57 #endif
58 
59 typedef struct tagbrowse_info
60 {
65  LAYOUT_DATA *layout; /* filled by LayoutInit, used by LayoutUpdate */
67  ULONG hNotify; /* change notification handle */
68 } browse_info;
69 
70 typedef struct tagTV_ITEMDATA
71 {
72  LPSHELLFOLDER lpsfParent; /* IShellFolder of the parent */
73  LPITEMIDLIST lpi; /* PIDL relative to parent */
74  LPITEMIDLIST lpifq; /* Fully qualified PIDL */
75  IEnumIDList* pEnumIL; /* Children iterator */
77 
78 #ifndef __REACTOS__ /* Defined in "layout.h" */
79 typedef struct tagLAYOUT_INFO
80 {
81  int iItemId; /* control id */
82  DWORD dwAnchor; /* BF_* flags specifying which margins should remain constant */
83 } LAYOUT_INFO;
84 #endif
85 
86 static const LAYOUT_INFO g_layout_info[] =
87 {
90 #ifndef __REACTOS__ /* Duplicated */
92 #endif
99 };
100 
101 #define LAYOUT_INFO_COUNT (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
102 
103 #define SUPPORTEDFLAGS (BIF_STATUSTEXT | \
104  BIF_BROWSEFORCOMPUTER | \
105  BIF_RETURNFSANCESTORS | \
106  BIF_RETURNONLYFSDIRS | \
107  BIF_NONEWFOLDERBUTTON | \
108  BIF_NEWDIALOGSTYLE | \
109  BIF_BROWSEINCLUDEFILES)
110 
111 static void FillTreeView(browse_info*, LPSHELLFOLDER,
115 
116 static const WCHAR szBrowseFolderInfo[] = {
117  '_','_','W','I','N','E','_',
118  'B','R','S','F','O','L','D','E','R','D','L','G','_',
119  'I','N','F','O',0
120 };
121 
122 static inline DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
123 {
124  return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
125 }
126 
127 static void browsefolder_callback( LPBROWSEINFOW lpBrowseInfo, HWND hWnd,
128  UINT msg, LPARAM param )
129 {
130  if (!lpBrowseInfo->lpfn)
131  return;
132  lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
133 }
134 
135 #ifndef __REACTOS__ /* Defined in "layout.h" */
136 static LAYOUT_DATA *LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
137 {
138  LAYOUT_DATA *data;
139  RECT rcWnd;
140  int i;
141 
142  GetClientRect(hwnd, &rcWnd);
143  data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count);
144  for (i = 0; i < layout_count; i++)
145  {
146  RECT r;
147  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
148 
149  if (hItem == NULL)
150  ERR("Item %d not found\n", i);
151  GetWindowRect(hItem, &r);
153 
154  data[i].left = r.left;
155  data[i].right = rcWnd.right - r.right;
156  data[i].width = r.right - r.left;
157 
158  data[i].top = r.top;
159  data[i].bottom = rcWnd.bottom - r.bottom;
160  data[i].height = r.bottom - r.top;
161  }
162  return data;
163 }
164 
165 static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
166 {
167  RECT rcWnd;
168  int i;
169 
170  GetClientRect(hwnd, &rcWnd);
171  for (i = 0; i < layout_count; i++)
172  {
173  RECT r;
174  HWND hItem = GetDlgItem(hwnd, layout_info[i].iItemId);
175 
176  GetWindowRect(hItem, &r);
178 
179  if (layout_info[i].dwAnchor & BF_RIGHT)
180  {
181  r.right = rcWnd.right - data[i].right;
182  if (!(layout_info[i].dwAnchor & BF_LEFT))
183  r.left = r.right - data[i].width;
184  }
185 
186  if (layout_info[i].dwAnchor & BF_BOTTOM)
187  {
188  r.bottom = rcWnd.bottom - data[i].bottom;
189  if (!(layout_info[i].dwAnchor & BF_TOP))
190  r.top = r.bottom - data[i].height;
191  }
192 
193  SetWindowPos(hItem, NULL, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
194  }
195 }
196 #endif
197 
198 
199 /******************************************************************************
200  * InitializeTreeView [Internal]
201  *
202  * Called from WM_INITDIALOG handler.
203  *
204  * PARAMS
205  * hwndParent [I] The BrowseForFolder dialog
206  * root [I] ITEMIDLIST of the root shell folder
207  */
209 {
210  LPITEMIDLIST pidlParent, pidlChild;
211  HIMAGELIST hImageList;
212  HRESULT hr;
213  IShellFolder *lpsfParent, *lpsfRoot;
214  IEnumIDList * pEnumChildren = NULL;
215  HTREEITEM item;
216  DWORD flags;
217  LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot;
218 
219  TRACE("%p\n", info );
220 
221  Shell_GetImageLists(NULL, &hImageList);
222 
223  if (hImageList)
224  SendMessageW( info->hwndTreeView, TVM_SETIMAGELIST, 0, (LPARAM)hImageList );
225 
226  /* We want to call InsertTreeViewItem down the code, in order to insert
227  * the root item of the treeview. Due to InsertTreeViewItem's signature,
228  * we need the following to do this:
229  *
230  * + An ITEMIDLIST corresponding to _the parent_ of root.
231  * + An ITEMIDLIST, which is a relative path from root's parent to root
232  * (containing a single SHITEMID).
233  * + An IShellFolder interface pointer of root's parent folder.
234  *
235  * If root is 'Desktop', then root's parent is also 'Desktop'.
236  */
237 
238  pidlParent = ILClone(root);
239  ILRemoveLastID(pidlParent);
240  pidlChild = ILClone(ILFindLastID(root));
241 
242  if (_ILIsDesktop(pidlParent)) {
243  hr = SHGetDesktopFolder(&lpsfParent);
244  } else {
245  IShellFolder *lpsfDesktop;
246  hr = SHGetDesktopFolder(&lpsfDesktop);
247  if (FAILED(hr)) {
248  WARN("SHGetDesktopFolder failed! hr = %08x\n", hr);
249  ILFree(pidlChild);
250  ILFree(pidlParent);
251  return;
252  }
253  hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (LPVOID*)&lpsfParent);
254  IShellFolder_Release(lpsfDesktop);
255  }
256 
257  if (FAILED(hr)) {
258  WARN("Could not bind to parent shell folder! hr = %08x\n", hr);
259  ILFree(pidlChild);
260  ILFree(pidlParent);
261  return;
262  }
263 
264  if (!_ILIsEmpty(pidlChild)) {
265  hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot);
266  } else {
267  lpsfRoot = lpsfParent;
268  hr = IShellFolder_AddRef(lpsfParent);
269  }
270 
271  if (FAILED(hr)) {
272  WARN("Could not bind to root shell folder! hr = %08x\n", hr);
273  IShellFolder_Release(lpsfParent);
274  ILFree(pidlChild);
275  ILFree(pidlParent);
276  return;
277  }
278 
279  flags = BrowseFlagsToSHCONTF( info->lpBrowseInfo->ulFlags );
280  hr = IShellFolder_EnumObjects( lpsfRoot, info->hWnd, flags, &pEnumChildren );
281  if (FAILED(hr)) {
282  WARN("Could not get child iterator! hr = %08x\n", hr);
283  IShellFolder_Release(lpsfParent);
284  IShellFolder_Release(lpsfRoot);
285  ILFree(pidlChild);
286  ILFree(pidlParent);
287  return;
288  }
289 
290  SendMessageW( info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT );
291  item = InsertTreeViewItem( info, lpsfParent, pidlChild,
292  pidlParent, pEnumChildren, TVI_ROOT );
293  SendMessageW( info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item );
294 
295  ILFree(pidlChild);
296  ILFree(pidlParent);
297  IShellFolder_Release(lpsfRoot);
298  IShellFolder_Release(lpsfParent);
299 }
300 
302 {
303  SHFILEINFOW sfi;
304  SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
305  return sfi.iIcon;
306 }
307 
308 static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
309 {
310  LPITEMIDLIST pidlDesktop = NULL;
311  DWORD flags;
312 
313  TRACE("%p %p\n",lpifq, lpTV_ITEM);
314 
315  if (!lpifq)
316  {
317  pidlDesktop = _ILCreateDesktop();
318  lpifq = pidlDesktop;
319  }
320 
322  lpTV_ITEM->iImage = GetIcon( lpifq, flags );
323 
325  lpTV_ITEM->iSelectedImage = GetIcon( lpifq, flags );
326 
327  if (pidlDesktop)
328  ILFree( pidlDesktop );
329 }
330 
331 /******************************************************************************
332  * GetName [Internal]
333  *
334  * Query a shell folder for the display name of one of its children
335  *
336  * PARAMS
337  * lpsf [I] IShellFolder interface of the folder to be queried.
338  * lpi [I] ITEMIDLIST of the child, relative to parent
339  * dwFlags [I] as in IShellFolder::GetDisplayNameOf
340  * lpFriendlyName [O] The desired display name in unicode
341  *
342  * RETURNS
343  * Success: TRUE
344  * Failure: FALSE
345  */
346 static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
347 {
349  STRRET str;
350 
351  TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
352  if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
353  bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi);
354  else
355  bSuccess = FALSE;
356 
357  TRACE("-- %s\n", debugstr_w(lpFriendlyName));
358  return bSuccess;
359 }
360 
361 /******************************************************************************
362  * InsertTreeViewItem [Internal]
363  *
364  * PARAMS
365  * info [I] data for the dialog
366  * lpsf [I] IShellFolder interface of the item's parent shell folder
367  * pidl [I] ITEMIDLIST of the child to insert, relative to parent
368  * pidlParent [I] ITEMIDLIST of the parent shell folder
369  * pEnumIL [I] Iterator for the children of the item to be inserted
370  * hParent [I] The treeview-item that represents the parent shell folder
371  *
372  * RETURNS
373  * Success: Handle to the created and inserted treeview-item
374  * Failure: NULL
375  */
377  LPCITEMIDLIST pidl, LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL,
379 {
380  TVITEMW tvi;
381  TVINSERTSTRUCTW tvins;
382  WCHAR szBuff[MAX_PATH];
383  LPTV_ITEMDATA lptvid=0;
384 
386 
387  tvi.cChildren= pEnumIL ? 1 : 0;
388  tvi.mask |= TVIF_CHILDREN;
389 
390  if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
391  return NULL;
392 
393  lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
394  if (!lptvid)
395  return NULL;
396 
397  tvi.pszText = szBuff;
398  tvi.cchTextMax = MAX_PATH;
399  tvi.lParam = (LPARAM)lptvid;
400 
401  IShellFolder_AddRef(lpsf);
402  lptvid->lpsfParent = lpsf;
403  lptvid->lpi = ILClone(pidl);
404  lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
405  lptvid->pEnumIL = pEnumIL;
406  GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
407 
408  tvins.u.item = tvi;
409  tvins.hInsertAfter = NULL;
410  tvins.hParent = hParent;
411 
412  return TreeView_InsertItem( info->hwndTreeView, &tvins );
413 }
414 
415 /******************************************************************************
416  * FillTreeView [Internal]
417  *
418  * For each child (given by lpe) of the parent shell folder, which is given by
419  * lpsf and whose PIDL is pidl, insert a treeview-item right under hParent
420  *
421  * PARAMS
422  * info [I] data for the dialog
423  * lpsf [I] IShellFolder interface of the parent shell folder
424  * pidl [I] ITEMIDLIST of the parent shell folder
425  * hParent [I] The treeview item that represents the parent shell folder
426  * lpe [I] An iterator for the children of the parent shell folder
427  */
430 {
431  LPITEMIDLIST pidlTemp = 0;
432  ULONG ulFetched;
433  HRESULT hr;
434  HWND hwnd = GetParent( info->hwndTreeView );
435 
436  TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe);
437 
438  /* No IEnumIDList -> No children */
439  if (!lpe) return;
440 
441  SetCapture( hwnd );
443 
444  while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
445  {
446  ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
447  IEnumIDList* pEnumIL = NULL;
448  IShellFolder* pSFChild = NULL;
449  IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
450  if (ulAttrs & SFGAO_FOLDER)
451  {
452  hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
453  if (SUCCEEDED(hr))
454  {
455  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
456  hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL);
457  if (hr == S_OK)
458  {
459  if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) ||
460  FAILED(IEnumIDList_Reset(pEnumIL)))
461  {
462  IEnumIDList_Release(pEnumIL);
463  pEnumIL = NULL;
464  }
465  }
466  IShellFolder_Release(pSFChild);
467  }
468  }
469 
470  if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))
471  goto done;
472  SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */
473  pidlTemp=NULL;
474  }
475 
476 done:
477  ReleaseCapture();
479  SHFree(pidlTemp);
480 }
481 
483 {
485  if (!data)
486  return FALSE;
487  return (data->type == type);
488 }
489 
491 {
492  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
493  LPCITEMIDLIST pidl = lptvid->lpi;
494  BOOL bEnabled = TRUE;
496  HRESULT r;
497 
498  if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
499  !PIDLIsType(pidl, PT_COMP))
500  bEnabled = FALSE;
501  if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
502  {
503  dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
504  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
505  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
506  if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
507  bEnabled = FALSE;
508  }
509 
510  dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
511  r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
512  (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
513  if (FAILED(r) ||
514  ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
515  {
516  if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
517  bEnabled = FALSE;
519  }
520  else
522 
523  SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
524 }
525 
527 {
528  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA)pnmtv->itemOld.lParam;
529 
530  TRACE("TVN_DELETEITEMA/W %p\n", lptvid);
531 
532  IShellFolder_Release(lptvid->lpsfParent);
533  if (lptvid->pEnumIL)
534  IEnumIDList_Release(lptvid->pEnumIL);
535  SHFree(lptvid->lpi);
536  SHFree(lptvid->lpifq);
537  SHFree(lptvid);
538  return 0;
539 }
540 
542 {
543  IShellFolder *lpsf2 = NULL;
544  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
545  HRESULT r;
546 
547  TRACE("TVN_ITEMEXPANDINGA/W\n");
548 
549  if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
550  return 0;
551 
552  if (!_ILIsEmpty(lptvid->lpi)) {
553  r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
554  &IID_IShellFolder, (void**)&lpsf2 );
555  } else {
556  lpsf2 = lptvid->lpsfParent;
557  IShellFolder_AddRef(lpsf2);
558  r = S_OK;
559  }
560 
561  if (SUCCEEDED(r))
562  {
563  FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
564  IShellFolder_Release( lpsf2 );
565  }
566 
567  /* My Computer is already sorted and trying to do a simple text
568  * sort will only mess things up */
569  if (!_ILIsMyComputer(lptvid->lpi))
570  SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
571  FALSE, (LPARAM)pnmtv->itemNew.hItem );
572 
573  return 0;
574 }
575 
577 {
578  LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
580 
581  ILFree(info->pidlRet);
582  info->pidlRet = ILClone(lptvid->lpifq);
583 
584  if (GetName(lptvid->lpsfParent, lptvid->lpi, SHGDN_NORMAL, name))
586 
587  browsefolder_callback( info->lpBrowseInfo, info->hWnd, BFFM_SELCHANGED,
588  (LPARAM)info->pidlRet );
590  return S_OK;
591 }
592 
594 {
595  LPTV_ITEMDATA item_data;
596  WCHAR old_path[MAX_PATH], new_path[MAX_PATH], *p;
597  NMTREEVIEWW nmtv;
598  TVITEMW item;
599 
600  if(!pnmtv->item.pszText)
601  return 0;
602 
603  item.mask = TVIF_HANDLE|TVIF_PARAM;
604  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
605  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
606  item_data = (LPTV_ITEMDATA)item.lParam;
607 
608  SHGetPathFromIDListW(item_data->lpifq, old_path);
609  if(!(p = strrchrW(old_path, '\\')))
610  return 0;
611  p = new_path+(p-old_path+1);
612  memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR));
613  strcpyW(p, pnmtv->item.pszText);
614 
615  if(!MoveFileW(old_path, new_path))
616  return 0;
617 
618  SHFree(item_data->lpifq);
619  SHFree(item_data->lpi);
620  item_data->lpifq = SHSimpleIDListFromPathW(new_path);
621  IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL,
622  pnmtv->item.pszText, NULL, &item_data->lpi, NULL);
623 
624  item.mask = TVIF_HANDLE|TVIF_TEXT;
625  item.pszText = pnmtv->item.pszText;
626  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
627 
628  nmtv.itemNew.lParam = item.lParam;
630  return 0;
631 }
632 
634 {
636  SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
637  return S_OK;
638 }
639 
640 #ifdef __REACTOS__
641 static void
642 BrsFolder_Delete(browse_info *info, HTREEITEM selected_item)
643 {
644  TV_ITEMW item;
645  TV_ITEMDATA *item_data;
646  SHFILEOPSTRUCTW fileop = { info->hwndTreeView };
647  WCHAR szzFrom[MAX_PATH + 1];
648 
649  /* get item_data */
650  item.mask = TVIF_HANDLE | TVIF_PARAM;
651  item.hItem = selected_item;
652  if (!SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item))
653  {
654  ERR("TVM_GETITEMW failed\n");
655  return;
656  }
657  item_data = (TV_ITEMDATA *)item.lParam;
658 
659  /* get the path */
660  if (!SHGetPathFromIDListW(item_data->lpifq, szzFrom))
661  {
662  ERR("SHGetPathFromIDListW failed\n");
663  return;
664  }
665  szzFrom[lstrlenW(szzFrom) + 1] = 0; /* double NULL-terminated */
666  fileop.pFrom = szzFrom;
667 
668  /* delete folder */
669  fileop.fFlags = FOF_ALLOWUNDO;
670  fileop.wFunc = FO_DELETE;
671  SHFileOperationW(&fileop);
672 }
673 #endif
675 {
676  HTREEITEM selected_item;
677 
678  /* Old dialog doesn't support those advanced features */
679  if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
680  return 0;
681 
682  selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
683 
684  switch (keydown->wVKey)
685  {
686  case VK_F2:
687  BrsFolder_Rename(info, selected_item);
688  break;
689  case VK_DELETE:
690  {
691 #ifdef __REACTOS__
692  BrsFolder_Delete(info, selected_item);
693 #else
694  const ITEMIDLIST *item_id;
695  ISFHelper *psfhlp;
696  HRESULT hr;
697  TVITEMW item;
698  TV_ITEMDATA *item_data;
699 
700  item.mask = TVIF_PARAM;
701  item.mask = TVIF_HANDLE|TVIF_PARAM;
702  item.hItem = selected_item;
703  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
704  item_data = (TV_ITEMDATA *)item.lParam;
705  item_id = item_data->lpi;
706 
707  hr = IShellFolder_QueryInterface(item_data->lpsfParent, &IID_ISFHelper, (void**)&psfhlp);
708  if(FAILED(hr))
709  return 0;
710 
711  /* perform the item deletion - tree view gets updated over shell notification */
712  ISFHelper_DeleteItems(psfhlp, 1, &item_id);
713  ISFHelper_Release(psfhlp);
714 #endif
715  }
716  break;
717  }
718  return 0;
719 }
720 
722 {
723  NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
724 
725  TRACE("%p %x %p msg=%x\n", info, CtlID, lpnmh, pnmtv->hdr.code);
726 
728  return 0;
729 
730  switch (pnmtv->hdr.code)
731  {
732  case TVN_DELETEITEMA:
733  case TVN_DELETEITEMW:
734  return BrsFolder_Treeview_Delete( info, pnmtv );
735 
736  case TVN_ITEMEXPANDINGA:
737  case TVN_ITEMEXPANDINGW:
738  return BrsFolder_Treeview_Expand( info, pnmtv );
739 
740  case TVN_SELCHANGEDA:
741  case TVN_SELCHANGEDW:
742  return BrsFolder_Treeview_Changed( info, pnmtv );
743 
744  case TVN_ENDLABELEDITA:
745  case TVN_ENDLABELEDITW:
747 
748  case TVN_KEYDOWN:
750 
751  default:
752  WARN("unhandled (%d)\n", pnmtv->hdr.code);
753  break;
754  }
755 
756  return 0;
757 }
758 
759 
761 {
762  LPITEMIDLIST computer_pidl;
763  SHChangeNotifyEntry ntreg;
764  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
765 
766  info->hWnd = hWnd;
768 
769  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
770  FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n");
771  if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
772  FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
773 
774  if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
775  {
776  RECT rcWnd;
777 
779 
780  /* TODO: Windows allows shrinking the windows a bit */
781  GetWindowRect(hWnd, &rcWnd);
782  info->szMin.cx = rcWnd.right - rcWnd.left;
783  info->szMin.cy = rcWnd.bottom - rcWnd.top;
784  }
785  else
786  {
787  info->layout = NULL;
788  }
789 
790  if (lpBrowseInfo->lpszTitle)
792  else
794 
795  if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)
796  || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
798 
799  /* Hide "Make New Folder" Button? */
800  if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON)
801  || !(lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
803 
804  /* Hide the editbox? */
805  if (!(lpBrowseInfo->ulFlags & BIF_EDITBOX))
806  {
809  }
810 
812  if (info->hwndTreeView)
813  {
815 
816  /* Resize the treeview if there's not editbox */
817  if ((lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)
818  && !(lpBrowseInfo->ulFlags & BIF_EDITBOX))
819  {
820  RECT rc;
821  GetClientRect(info->hwndTreeView, &rc);
822  SetWindowPos(info->hwndTreeView, HWND_TOP, 0, 0,
823  rc.right, rc.bottom + 40, SWP_NOMOVE);
824  }
825  }
826  else
827  ERR("treeview control missing!\n");
828 
829  /* Register for change notifications */
830  SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, 0, &computer_pidl);
831 
832  ntreg.pidl = computer_pidl;
833  ntreg.fRecursive = TRUE;
834 
836 
837  browsefolder_callback( info->lpBrowseInfo, hWnd, BFFM_INITIALIZED, 0 );
838 
839  return TRUE;
840 }
841 
843 {
844  DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
845  IShellFolder *desktop, *cur;
846 #ifdef __REACTOS__
847  WCHAR wszNewFolder[25];
849 #else
850  ISFHelper *sfhelper;
851 #endif
853  HTREEITEM parent, added;
854  LPTV_ITEMDATA item_data;
855  LPITEMIDLIST new_item;
856  TVITEMW item;
857  HRESULT hr;
858  int len;
859 
860 #ifdef __REACTOS__
861  hr = SHGetDesktopFolder(&desktop);
862  if(FAILED(hr))
863  return hr;
864 
865  if (info->pidlRet)
866  {
867  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
868  IShellFolder_Release(desktop);
869  if(FAILED(hr))
870  return hr;
871 
872  hr = SHGetPathFromIDListW(info->pidlRet, path);
873  }
874  else
875  {
876  cur = desktop;
878  }
879  if(FAILED(hr))
880  return hr;
881 
882  if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
883  return E_FAIL;
884 
885  if (!PathYetAnotherMakeUniqueName(name, path, NULL, wszNewFolder))
886  return E_FAIL;
887 
888  len = strlenW(path);
889  if(len<MAX_PATH && name[len] == L'\\')
890  len++;
891 #else
892  if(!info->pidlRet) {
893  ERR("Make new folder button should be disabled\n");
894  return E_FAIL;
895  }
896 
897  /* Create new directory */
898  hr = SHGetDesktopFolder(&desktop);
899  if(FAILED(hr))
900  return hr;
901 
902  hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);
903  IShellFolder_Release(desktop);
904  if(FAILED(hr))
905  return hr;
906 
907  hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);
908  if(FAILED(hr))
909  return hr;
910 
911  if(!SHGetPathFromIDListW(info->pidlRet, name)) {
912  hr = E_FAIL;
913  goto cleanup;
914  }
915 
916  len = strlenW(name);
917  if(len<MAX_PATH)
918  name[len++] = '\\';
919  hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);
920  ISFHelper_Release(sfhelper);
921  if(FAILED(hr))
922  goto cleanup;
923 #endif
924 
925  hr = E_FAIL;
926  if(!CreateDirectoryW(name, NULL))
927  goto cleanup;
928 
929  /* Update parent of newly created directory */
931  if(!parent)
932  goto cleanup;
933 
934  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)parent);
935 
936  memset(&item, 0, sizeof(TVITEMW));
937  item.mask = TVIF_PARAM|TVIF_STATE;
938  item.hItem = parent;
939  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
940  item_data = (LPTV_ITEMDATA)item.lParam;
941  if(!item_data)
942  goto cleanup;
943 
944  if(item_data->pEnumIL)
945  IEnumIDList_Release(item_data->pEnumIL);
946  hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);
947  if(FAILED(hr))
948  goto cleanup;
949 
950  /* Update treeview */
951  if(!(item.state&TVIS_EXPANDEDONCE)) {
952  item.mask = TVIF_STATE;
953  item.state = TVIS_EXPANDEDONCE;
954  item.stateMask = TVIS_EXPANDEDONCE;
955  SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);
956  }
957 
958  hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);
959  if(FAILED(hr))
960  goto cleanup;
961 
962  added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);
963  IShellFolder_Release(cur);
964  SHFree(new_item);
965 
967  return BrsFolder_Rename(info, added);
968 
969 cleanup:
970  return hr;
971 }
972 
974 {
975  LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
976 #ifdef __REACTOS__
978 #endif
979 
980  switch (id)
981  {
982  case IDOK:
983 #ifdef __REACTOS__
984  /* Get the text */
986  StrTrimW(szPath, L" \t");
987 
988  /* The original pidl is owned by the treeview and will be free'd. */
990  {
991  /* It's valid path */
992  info->pidlRet = ILCreateFromPathW(szPath);
993  }
994  else
995  {
996  info->pidlRet = ILClone(info->pidlRet);
997  }
998 #endif
999  if (info->pidlRet == NULL) /* A null pidl would mean a cancel */
1000  info->pidlRet = _ILCreateDesktop();
1001  pdump( info->pidlRet );
1002  if (lpBrowseInfo->pszDisplayName)
1003  SHGetPathFromIDListW( info->pidlRet, lpBrowseInfo->pszDisplayName );
1004  EndDialog( info->hWnd, 1 );
1005  return TRUE;
1006 
1007  case IDCANCEL:
1008  EndDialog( info->hWnd, 0 );
1009  return TRUE;
1010 
1013  return TRUE;
1014  }
1015  return FALSE;
1016 }
1017 
1019  BOOL is_str, HTREEITEM *pItem)
1020 {
1021  LPITEMIDLIST pidlSelection = selection;
1022  LPCITEMIDLIST pidlCurrent, pidlRoot;
1023  TVITEMEXW item;
1024  BOOL bResult = FALSE;
1025 
1026  memset(&item, 0, sizeof(item));
1027 
1028  /* If 'selection' is a string, convert to a Shell ID List. */
1029  if (is_str) {
1030  IShellFolder *psfDesktop;
1031  HRESULT hr;
1032 
1033  hr = SHGetDesktopFolder(&psfDesktop);
1034  if (FAILED(hr))
1035  goto done;
1036 
1037  hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL,
1038  selection, NULL, &pidlSelection, NULL);
1039  IShellFolder_Release(psfDesktop);
1040  if (FAILED(hr))
1041  goto done;
1042  }
1043 #ifdef __REACTOS__
1044  if (_ILIsDesktop(pidlSelection))
1045  {
1046  item.hItem = TVI_ROOT;
1047  bResult = TRUE;
1048  goto done;
1049  }
1050 #endif
1051 
1052  /* Move pidlCurrent behind the SHITEMIDs in pidlSelection, which are the root of
1053  * the sub-tree currently displayed. */
1054  pidlRoot = info->lpBrowseInfo->pidlRoot;
1055  pidlCurrent = pidlSelection;
1056  while (!_ILIsEmpty(pidlRoot) && _ILIsEqualSimple(pidlRoot, pidlCurrent)) {
1057  pidlRoot = ILGetNext(pidlRoot);
1058  pidlCurrent = ILGetNext(pidlCurrent);
1059  }
1060 
1061  /* The given ID List is not part of the SHBrowseForFolder's current sub-tree. */
1062  if (!_ILIsEmpty(pidlRoot))
1063  goto done;
1064 
1065  /* Initialize item to point to the first child of the root folder. */
1066  item.mask = TVIF_PARAM;
1067  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1068 
1069  if (item.hItem)
1070  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1071  (LPARAM)item.hItem);
1072 
1073  /* Walk the tree along the nodes corresponding to the remaining ITEMIDLIST */
1074  while (item.hItem && !_ILIsEmpty(pidlCurrent)) {
1075  LPTV_ITEMDATA pItemData;
1076 
1077  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1078  pItemData = (LPTV_ITEMDATA)item.lParam;
1079 
1080  if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) {
1081  pidlCurrent = ILGetNext(pidlCurrent);
1082  if (!_ILIsEmpty(pidlCurrent)) {
1083  /* Only expand current node and move on to its first child,
1084  * if we didn't already reach the last SHITEMID */
1085  SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem);
1086  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD,
1087  (LPARAM)item.hItem);
1088  }
1089  } else {
1090  item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT,
1091  (LPARAM)item.hItem);
1092  }
1093  }
1094 
1095  if (_ILIsEmpty(pidlCurrent) && item.hItem)
1096  bResult = TRUE;
1097 
1098 done:
1099  if (pidlSelection && pidlSelection != selection)
1100  ILFree(pidlSelection);
1101 
1102  if (pItem)
1103  *pItem = item.hItem;
1104 
1105  return bResult;
1106 }
1107 
1109  HTREEITEM hItem;
1110  BOOL bResult;
1111 
1112  if (!selection) return FALSE;
1113 
1114  bResult = BrsFolder_OnSetExpanded(info, selection, is_str, &hItem);
1115  if (bResult)
1116  SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem );
1117  return bResult;
1118 }
1119 
1121  LPWSTR selectionW = NULL;
1122  BOOL result = FALSE;
1123  int length;
1124 
1125  if (!is_str)
1126  return BrsFolder_OnSetSelectionW(info, selection, is_str);
1127 
1128  if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
1129  (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) &&
1130  MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
1131  {
1132  result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
1133  }
1134 
1135  HeapFree(GetProcessHeap(), 0, selectionW);
1136  return result;
1137 }
1138 
1139 #ifndef __REACTOS__ /* This is a buggy way (resize on title bar) */
1141 {
1142  if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE))
1143  {
1144  if (pos->cx < info->szMin.cx)
1145  pos->cx = info->szMin.cx;
1146  if (pos->cy < info->szMin.cy)
1147  pos->cy = info->szMin.cy;
1148  }
1149  return 0;
1150 }
1151 #endif
1152 
1154 {
1155  if (info->layout)
1156  {
1157 #ifdef __REACTOS__
1158  LayoutDestroy(info->layout);
1159 #else
1160  SHFree(info->layout);
1161 #endif
1162  info->layout = NULL;
1163  }
1164 
1165  SHChangeNotifyDeregister(info->hNotify);
1166 
1167  return 0;
1168 }
1169 
1170 /* Find a treeview node by recursively walking the treeview */
1172 {
1173  TV_ITEMW item;
1174  TV_ITEMDATA *item_data;
1175  HRESULT hr;
1176 
1177  item.mask = TVIF_HANDLE | TVIF_PARAM;
1178  item.hItem = hItem;
1179  SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);
1180  item_data = (TV_ITEMDATA *)item.lParam;
1181 
1182  hr = IShellFolder_CompareIDs(item_data->lpsfParent, 0, item_data->lpifq, pidl);
1183  if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
1184  return hItem;
1185 
1187 
1188  while (hItem)
1189  {
1190  HTREEITEM newItem = BrsFolder_FindItemByPidl(info, pidl, hItem);
1191  if (newItem)
1192  return newItem;
1194  }
1195  return NULL;
1196 }
1197 
1199 {
1200  BOOL ret = TRUE;
1201 
1202  TRACE("(%p)->(%p, %p, 0x%08x)\n", info, pidls[0], pidls[1], event);
1203 
1204  switch (event)
1205  {
1206  case SHCNE_RMDIR:
1207  case SHCNE_DELETE:
1208  {
1209  HTREEITEM handle_root = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_ROOT, 0);
1210  HTREEITEM handle_item = BrsFolder_FindItemByPidl(info, pidls[0], handle_root);
1211 
1212  if (handle_item)
1213  SendMessageW(info->hwndTreeView, TVM_DELETEITEM, 0, (LPARAM)handle_item);
1214 
1215  break;
1216  }
1217  }
1218  return ret;
1219 }
1220 
1221 /*************************************************************************
1222  * BrsFolderDlgProc32 (not an exported API function)
1223  */
1225  LPARAM lParam )
1226 {
1227  browse_info *info;
1228 
1229  TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam );
1230 
1231  if (msg == WM_INITDIALOG)
1232  return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );
1233 
1235 
1236  switch (msg)
1237  {
1238  case WM_NOTIFY:
1240 
1241  case WM_COMMAND:
1242  return BrsFolder_OnCommand( info, wParam );
1243 
1244 #ifdef __REACTOS__
1245  case WM_GETMINMAXINFO:
1246  ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = info->szMin.cx;
1247  ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = info->szMin.cy;
1248  return 0;
1249 #else /* This is a buggy way (resize on title bar) */
1250  case WM_WINDOWPOSCHANGING:
1252 #endif
1253 
1254  case WM_SIZE:
1255  if (info->layout) /* new style dialogs */
1257  return 0;
1258 
1259  case BFFM_SETSTATUSTEXTA:
1260  TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
1262  break;
1263 
1264  case BFFM_SETSTATUSTEXTW:
1265  TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
1267  break;
1268 
1269  case BFFM_ENABLEOK:
1270  TRACE("Enable %ld\n", lParam);
1271  EnableWindow(GetDlgItem(hWnd, 1), lParam != 0);
1272  break;
1273 
1274  case BFFM_SETOKTEXT: /* unicode only */
1275  TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam));
1277  break;
1278 
1279  case BFFM_SETSELECTIONA:
1281 
1282  case BFFM_SETSELECTIONW:
1284 
1285  case BFFM_SETEXPANDED: /* unicode only */
1287 
1288  case SHV_CHANGE_NOTIFY:
1290 
1291  case WM_DESTROY:
1292  return BrsFolder_OnDestroy(info);
1293  }
1294  return FALSE;
1295 }
1296 
1297 #ifndef __REACTOS__
1298 static const WCHAR swBrowseTemplateName[] = {
1299  'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0};
1300 static const WCHAR swNewBrowseTemplateName[] = {
1301  'S','H','N','E','W','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0};
1302 #endif
1303 
1304 /*************************************************************************
1305  * SHBrowseForFolderA [SHELL32.@]
1306  * SHBrowseForFolder [SHELL32.@]
1307  */
1309 {
1310  BROWSEINFOW bi;
1311  LPITEMIDLIST lpid;
1312  INT len;
1313  LPWSTR title;
1314 
1315  TRACE("%p\n", lpbi);
1316 
1317  bi.hwndOwner = lpbi->hwndOwner;
1318  bi.pidlRoot = lpbi->pidlRoot;
1319  if (lpbi->pszDisplayName)
1320  bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
1321  else
1322  bi.pszDisplayName = NULL;
1323 
1324  if (lpbi->lpszTitle)
1325  {
1326  len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
1327  title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1328  MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
1329  }
1330  else
1331  title = NULL;
1332 
1333  bi.lpszTitle = title;
1334  bi.ulFlags = lpbi->ulFlags;
1335  bi.lpfn = lpbi->lpfn;
1336  bi.lParam = lpbi->lParam;
1337  bi.iImage = lpbi->iImage;
1338  lpid = SHBrowseForFolderW( &bi );
1339  if (bi.pszDisplayName)
1340  {
1342  lpbi->pszDisplayName, MAX_PATH, 0, NULL);
1344  }
1345  HeapFree(GetProcessHeap(), 0, title);
1346  lpbi->iImage = bi.iImage;
1347  return lpid;
1348 }
1349 
1350 
1351 /*************************************************************************
1352  * SHBrowseForFolderW [SHELL32.@]
1353  *
1354  * NOTES
1355  * crashes when passed a null pointer
1356  */
1358 {
1359  browse_info info;
1360  DWORD r;
1361  HRESULT hr;
1362 #ifdef __REACTOS__
1363  WORD wDlgId;
1364 #else
1365  const WCHAR * templateName;
1366  INITCOMMONCONTROLSEX icex;
1367 #endif
1368 
1369  info.hWnd = 0;
1370  info.pidlRet = NULL;
1371  info.lpBrowseInfo = lpbi;
1372  info.hwndTreeView = NULL;
1373 
1374 #ifndef __REACTOS__
1375  icex.dwSize = sizeof( icex );
1376  icex.dwICC = ICC_TREEVIEW_CLASSES;
1377  InitCommonControlsEx( &icex );
1378 #endif
1379 
1380  hr = OleInitialize(NULL);
1381 
1382  if (lpbi->ulFlags & BIF_NEWDIALOGSTYLE)
1383  wDlgId = IDD_BROWSE_FOR_FOLDER_NEW;
1384  else
1385  wDlgId = IDD_BROWSE_FOR_FOLDER;
1388  if (SUCCEEDED(hr))
1389  OleUninitialize();
1390  if (!r)
1391  {
1392  ILFree(info.pidlRet);
1393  return NULL;
1394  }
1395 
1396  return info.pidlRet;
1397 }
WINE_DEFAULT_DEBUG_CHANNEL(shell)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:541
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:387
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:389
struct tagLAYOUT_DATA LAYOUT_DATA
int cchTextMax
Definition: commctrl.h:3317
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define IDS_NEWFOLDER
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1120
#define SHCNE_RMDIR
Definition: shlobj.h:1733
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
#define IDOK
Definition: winuser.h:824
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HTREEITEM hParent
Definition: commctrl.h:3389
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
TVITEMW itemOld
Definition: commctrl.h:3633
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:376
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
Definition: layout.h:226
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WideCharToMultiByte
Definition: compat.h:111
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:308
HRESULT hr
Definition: shlfolder.c:183
struct tagTV_ITEMDATA * LPTV_ITEMDATA
#define TV_ITEMW
Definition: commctrl.h:3293
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TVM_EXPAND
Definition: commctrl.h:3415
#define TVM_SELECTITEM
Definition: commctrl.h:3474
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVM_SORTCHILDREN
Definition: commctrl.h:3537
#define TVGN_CARET
Definition: commctrl.h:3457
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1920
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
#define TVN_DELETEITEMA
Definition: commctrl.h:3703
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:346
#define SW_HIDE
Definition: winuser.h:762
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:101
#define CP_ACP
Definition: compat.h:109
int iImage
Definition: commctrl.h:3318
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:490
#define WARN(fmt,...)
Definition: debug.h:112
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:576
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
#define TVGN_NEXT
Definition: commctrl.h:3449
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
#define BIF_BROWSEINCLUDEFILES
Definition: shlobj.h:1159
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1198
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define CALLBACK
Definition: compat.h:35
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
HWND hWnd
Definition: settings.c:17
LPARAM lParam
Definition: commctrl.h:3321
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
Definition: brsfolder.c:482
#define BF_BOTTOM
Definition: winuser.h:457
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
LONG top
Definition: windef.h:307
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
LAYOUT_DATA * layout
Definition: brsfolder.c:65
HWND hwndOwner
Definition: shlobj.h:1127
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define HWND_TOP
Definition: winuser.h:1193
#define BFFM_SETSELECTIONA
Definition: shlobj.h:1172
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1154
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3281
#define BIF_EDITBOX
Definition: shlobj.h:1148
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
UINT uFlags
Definition: api.c:59
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
UINT mask
Definition: commctrl.h:3312
int32_t INT_PTR
Definition: typedefs.h:64
char * LPSTR
Definition: xmlstorage.h:182
FILEOP_FLAGS fFlags
Definition: shellapi.h:357
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:609
#define E_FAIL
Definition: ddrawi.h:102
struct tagLAYOUT_INFO LAYOUT_INFO
LPWSTR pszText
Definition: commctrl.h:3316
BFFCALLBACK lpfn
Definition: shlobj.h:1121
#define SHGFI_SMALLICON
Definition: shellapi.h:174
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1918
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define BFFM_SETEXPANDED
Definition: shlobj.h:1176
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
int selection
Definition: ctm.c:92
DWORD dwAttributes
Definition: vdmdbg.h:34
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
Definition: pidl.h:250
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:390
struct _test_info info[]
Definition: SetCursorPos.c:19
#define TVN_SELCHANGEDA
Definition: commctrl.h:3643
UINT code
Definition: winuser.h:3134
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3708
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:122
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
Definition: glfuncs.h:248
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:633
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:721
LPSTR pszDisplayName
Definition: shlobj.h:1118
#define TVM_SETITEMW
Definition: commctrl.h:3489
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
#define TVIF_CHILDREN
Definition: commctrl.h:3268
#define FALSE
Definition: types.h:117
HWND hwndTreeView
Definition: brsfolder.c:62
HTREEITEM hInsertAfter
Definition: commctrl.h:3390
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1753
long LONG
Definition: pedump.c:60
LPWSTR pszDisplayName
Definition: shlobj.h:1129
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
UINT_PTR idFrom
Definition: winuser.h:3133
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
#define BIF_RETURNFSANCESTORS
Definition: shlobj.h:1147
#define TVM_SETIMAGELIST
Definition: commctrl.h:3442
#define VK_F2
Definition: winuser.h:2231
HTREEITEM hItem
Definition: treelist.h:37
const WCHAR * str
#define TVGN_ROOT
Definition: commctrl.h:3448
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1774
smooth NULL
Definition: ftsmooth.c:416
#define SHGFI_OPENICON
Definition: shellapi.h:176
struct tagMINMAXINFO * LPMINMAXINFO
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define IDC_WAIT
Definition: winuser.h:684
#define BFFM_SETSELECTIONW
Definition: shlobj.h:1173
ULONG hNotify
Definition: brsfolder.c:67
LONG_PTR LPARAM
Definition: windef.h:208
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
LPITEMIDLIST pidlRet
Definition: brsfolder.c:64
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1108
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:384
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3696
int cChildren
Definition: commctrl.h:3320
#define TVN_SELCHANGEDW
Definition: commctrl.h:3644
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:388
#define VK_DELETE
Definition: winuser.h:2208
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
static const WCHAR swNewBrowseTemplateName[]
Definition: brsfolder.c:1300
#define WM_DESTROY
Definition: winuser.h:1591
#define TVN_DELETEITEMW
Definition: commctrl.h:3704
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:136
LPCWSTR lpszTitle
Definition: shlobj.h:1130
TVITEMW itemNew
Definition: commctrl.h:3634
BYTE PIDLTYPE
Definition: pidl.h:108
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define BIF_STATUSTEXT
Definition: shlobj.h:1146
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
r parent
Definition: btrfs.c:2944
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1120
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:165
#define TVM_EDITLABELW
Definition: commctrl.h:3496
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413
#define WM_SIZE
Definition: winuser.h:1593
#define debugstr_a
Definition: kernel32.h:31
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1018
LONG HRESULT
Definition: typedefs.h:79
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define BF_RIGHT
Definition: winuser.h:456
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
#define _countof(array)
Definition: sndvol32.h:68
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3707
LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi)
Definition: brsfolder.c:1308
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1117
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define TVE_EXPAND
Definition: commctrl.h:3419
GLbitfield flags
Definition: glext.h:7161
#define TVI_ROOT
Definition: commctrl.h:3364
LPCSTR lpszTitle
Definition: shlobj.h:1119
LPCWSTR pFrom
Definition: shellapi.h:355
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3410
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
static HRESULT BrsFolder_NewFolder(browse_info *info)
Definition: brsfolder.c:842
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1140
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1725
#define WM_COMMAND
Definition: winuser.h:1722
struct _cl_event * event
Definition: glext.h:7739
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1128
#define TVGN_CHILD
Definition: commctrl.h:3452
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
Definition: brsfolder.c:301
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:385
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
Definition: brsfolder.c:674
UINT ulFlags
Definition: shlobj.h:1120
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
#define TVIF_HANDLE
Definition: commctrl.h:3266
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brsfolder.c:1357
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:110
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
HWND WINAPI GetParent(_In_ HWND)
#define PT_COMP
Definition: pidl.h:99
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:593
LPARAM lParam
Definition: shlobj.h:1122
#define S_OK
Definition: intsafe.h:51
HWND WINAPI SetCapture(_In_ HWND hWnd)
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
UINT ulFlags
Definition: shlobj.h:1131
#define shell32_hInstance
static INT BrsFolder_OnDestroy(browse_info *info)
Definition: brsfolder.c:1153
static ATOM item
Definition: dde.c:856
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1144
LPARAM lParam
Definition: shlobj.h:1133
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:127
#define TVIF_TEXT
Definition: commctrl.h:3262
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
LPCWSTR szPath
Definition: env.c:35
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:973
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define SHCNE_DELETE
Definition: shlobj.h:1731
int iSelectedImage
Definition: commctrl.h:3319
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:208
#define BF_TOP
Definition: winuser.h:455
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BFFM_SETSTATUSTEXTA
Definition: shlobj.h:1170
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define SUPPORTEDFLAGS
Definition: brsfolder.c:103
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:391
#define HWND_DESKTOP
Definition: winuser.h:1195
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
unsigned int UINT
Definition: ndis.h:50
HTREEITEM hItem
Definition: commctrl.h:3313
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
Definition: brsfolder.c:760
static const WCHAR swBrowseTemplateName[]
Definition: brsfolder.c:1298
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2889
#define HRESULT_CODE(hr)
Definition: winerror.h:76
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
Definition: name.c:38
TVITEMW item
Definition: commctrl.h:3668
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:116
LPBROWSEINFOW lpBrowseInfo
Definition: brsfolder.c:63
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
unsigned int ULONG
Definition: retypes.h:1
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1171
LONG bottom
Definition: windef.h:309
#define TVIF_STATE
Definition: commctrl.h:3265
char * cleanup(char *str)
Definition: wpickclick.c:99
#define TVM_GETITEMW
Definition: commctrl.h:3482
UINT state
Definition: commctrl.h:3314
#define SWP_NOMOVE
Definition: winuser.h:1229
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2741
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)
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:368
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define BFFM_SETOKTEXT
Definition: shlobj.h:1175
#define TVIF_PARAM
Definition: commctrl.h:3264
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:982
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: brsfolder.c:1224
LPITEMIDLIST lpi
Definition: brsfolder.c:73
LONG_PTR LRESULT
Definition: windef.h:209
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
HWND hwndOwner
Definition: shlobj.h:1116
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define BFFM_SETSTATUSTEXTW
Definition: shlobj.h:1174
#define FO_DELETE
Definition: shellapi.h:135
#define BIF_BROWSEFORCOMPUTER
Definition: shlobj.h:1157
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
static char title[]
Definition: ps.c:92
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define TVN_KEYDOWN
Definition: commctrl.h:3709
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:86
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
#define HeapFree(x, y, z)
Definition: compat.h:594
DWORD dwAnchor
Definition: brsfolder.c:82
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:526
struct tagbrowse_info browse_info
#define WM_NOTIFY
Definition: richedit.h:61
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:386
#define SUCCEEDED(hr)
Definition: intsafe.h:49
#define BF_LEFT
Definition: winuser.h:454
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3695
struct tagTV_ITEMDATA TV_ITEMDATA