ReactOS  0.4.15-dev-1632-g4e289ce
brsfolder.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <undocshell.h>
#include <shellapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
Include dependency graph for brsfolder.c:

Go to the source code of this file.

Classes

struct  tagLAYOUT_DATA
 
struct  tagbrowse_info
 
struct  tagTV_ITEMDATA
 
struct  tagLAYOUT_INFO
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)
 
#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
 
#define SUPPORTEDFLAGS
 

Typedefs

typedef struct tagLAYOUT_DATA LAYOUT_DATA
 
typedef struct tagbrowse_info browse_info
 
typedef struct tagTV_ITEMDATA TV_ITEMDATA
 
typedef struct tagTV_ITEMDATALPTV_ITEMDATA
 
typedef struct tagLAYOUT_INFO LAYOUT_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static void FillTreeView (browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
 
static HTREEITEM InsertTreeViewItem (browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
 
static DWORD BrowseFlagsToSHCONTF (UINT ulFlags)
 
static void browsefolder_callback (LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
 
static LAYOUT_DATALayoutInit (HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
 
static void LayoutUpdate (HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
 
static void InitializeTreeView (browse_info *info)
 
static int GetIcon (LPCITEMIDLIST lpi, UINT uFlags)
 
static void GetNormalAndSelectedIcons (LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
 
static BOOL GetName (LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
 
static void FillTreeView (browse_info *info, IShellFolder *lpsf, LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList *lpe)
 
static BOOL PIDLIsType (LPCITEMIDLIST pidl, PIDLTYPE type)
 
static void BrsFolder_CheckValidSelection (browse_info *info, LPTV_ITEMDATA lptvid)
 
static LRESULT BrsFolder_Treeview_Delete (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Expand (browse_info *info, NMTREEVIEWW *pnmtv)
 
static HRESULT BrsFolder_Treeview_Changed (browse_info *info, NMTREEVIEWW *pnmtv)
 
static LRESULT BrsFolder_Treeview_Rename (browse_info *info, NMTVDISPINFOW *pnmtv)
 
static HRESULT BrsFolder_Rename (browse_info *info, HTREEITEM rename)
 
static LRESULT BrsFolder_Treeview_Keydown (browse_info *info, LPNMTVKEYDOWN keydown)
 
static LRESULT BrsFolder_OnNotify (browse_info *info, UINT CtlID, LPNMHDR lpnmh)
 
static BOOL BrsFolder_OnCreate (HWND hWnd, browse_info *info)
 
static HRESULT BrsFolder_NewFolder (browse_info *info)
 
static BOOL BrsFolder_OnCommand (browse_info *info, UINT id)
 
static BOOL BrsFolder_OnSetExpanded (browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
 
static BOOL BrsFolder_OnSetSelectionW (browse_info *info, LPVOID selection, BOOL is_str)
 
static BOOL BrsFolder_OnSetSelectionA (browse_info *info, LPVOID selection, BOOL is_str)
 
static LRESULT BrsFolder_OnWindowPosChanging (browse_info *info, WINDOWPOS *pos)
 
static INT BrsFolder_OnDestroy (browse_info *info)
 
static HTREEITEM BrsFolder_FindItemByPidl (browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
 
static LRESULT BrsFolder_OnChange (browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
 
static INT_PTR CALLBACK BrsFolderDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
 
LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
 

Variables

static const LAYOUT_INFO g_layout_info []
 
static const WCHAR szBrowseFolderInfo []
 
static const WCHAR swBrowseTemplateName []
 
static const WCHAR swNewBrowseTemplateName []
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 25 of file brsfolder.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file brsfolder.c.

◆ LAYOUT_INFO_COUNT

#define LAYOUT_INFO_COUNT   (sizeof(g_layout_info)/sizeof(g_layout_info[0]))

Definition at line 101 of file brsfolder.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 28 of file brsfolder.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 27 of file brsfolder.c.

◆ SHV_CHANGE_NOTIFY

#define SHV_CHANGE_NOTIFY   (WM_USER + 0x1111)

Definition at line 48 of file brsfolder.c.

◆ SUPPORTEDFLAGS

#define SUPPORTEDFLAGS
Value:
BIF_BROWSEFORCOMPUTER | \
BIF_RETURNFSANCESTORS | \
BIF_RETURNONLYFSDIRS | \
BIF_NONEWFOLDERBUTTON | \
BIF_NEWDIALOGSTYLE | \
BIF_BROWSEINCLUDEFILES)
#define BIF_STATUSTEXT
Definition: shlobj.h:1146

Definition at line 103 of file brsfolder.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file brsfolder.c.

Typedef Documentation

◆ browse_info

◆ LAYOUT_DATA

◆ LAYOUT_INFO

◆ LPTV_ITEMDATA

◆ TV_ITEMDATA

Function Documentation

◆ BrowseFlagsToSHCONTF()

static DWORD BrowseFlagsToSHCONTF ( UINT  ulFlags)
inlinestatic

Definition at line 122 of file brsfolder.c.

123 {
124  return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
125 }
#define BIF_BROWSEINCLUDEFILES
Definition: shlobj.h:1159

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ browsefolder_callback()

static void browsefolder_callback ( LPBROWSEINFOW  lpBrowseInfo,
HWND  hWnd,
UINT  msg,
LPARAM  param 
)
static

Definition at line 127 of file brsfolder.c.

129 {
130  if (!lpBrowseInfo->lpfn)
131  return;
132  lpBrowseInfo->lpfn( hWnd, msg, param, lpBrowseInfo->lParam );
133 }
HWND hWnd
Definition: settings.c:17
GLfloat param
Definition: glext.h:5796
LPARAM lParam
Definition: shlobj.h:1133
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define msg(x)
Definition: auth_time.c:54

Referenced by BrsFolder_OnCreate(), and BrsFolder_Treeview_Changed().

◆ BrsFolder_CheckValidSelection()

static void BrsFolder_CheckValidSelection ( browse_info info,
LPTV_ITEMDATA  lptvid 
)
static

Definition at line 490 of file brsfolder.c.

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 }
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
static BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
Definition: brsfolder.c:482
DWORD dwAttributes
Definition: vdmdbg.h:34
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BIF_RETURNFSANCESTORS
Definition: shlobj.h:1147
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
#define PT_COMP
Definition: pidl.h:99
UINT ulFlags
Definition: shlobj.h:1131
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1144
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPITEMIDLIST lpi
Definition: brsfolder.c:73
#define BIF_BROWSEFORCOMPUTER
Definition: shlobj.h:1157
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:387

Referenced by BrsFolder_Treeview_Changed().

◆ BrsFolder_FindItemByPidl()

static HTREEITEM BrsFolder_FindItemByPidl ( browse_info info,
LPCITEMIDLIST  pidl,
HTREEITEM  hItem 
)
static

Definition at line 1171 of file brsfolder.c.

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 }
HRESULT hr
Definition: shlfolder.c:183
#define TV_ITEMW
Definition: commctrl.h:3293
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVGN_NEXT
Definition: commctrl.h:3449
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
if SUCCEEDED(hr)
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
LONG HRESULT
Definition: typedefs.h:79
#define TVGN_CHILD
Definition: commctrl.h:3452
#define TVIF_HANDLE
Definition: commctrl.h:3266
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define HRESULT_CODE(hr)
Definition: winerror.h:76
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1171
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264

Referenced by BrsFolder_OnChange().

◆ BrsFolder_NewFolder()

static HRESULT BrsFolder_NewFolder ( browse_info info)
static

Definition at line 842 of file brsfolder.c.

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 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define IDS_NEWFOLDER
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:376
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
struct tagTV_ITEMDATA * LPTV_ITEMDATA
#define TVM_EXPAND
Definition: commctrl.h:3415
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVM_SORTCHILDREN
Definition: commctrl.h:3537
#define TVGN_CARET
Definition: commctrl.h:3457
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3281
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:122
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:633
#define TVM_SETITEMW
Definition: commctrl.h:3489
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
r parent
Definition: btrfs.c:2944
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVE_EXPAND
Definition: commctrl.h:3419
GLbitfield flags
Definition: glext.h:7161
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
FxCollectionEntry * cur
#define ERR(fmt,...)
Definition: debug.h:110
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
#define shell32_hInstance
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
Definition: name.c:38
#define TVIF_STATE
Definition: commctrl.h:3265
char * cleanup(char *str)
Definition: wpickclick.c:99
#define TVM_GETITEMW
Definition: commctrl.h:3482
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:368
#define TVIF_PARAM
Definition: commctrl.h:3264
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2027
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnCommand().

◆ BrsFolder_OnChange()

static LRESULT BrsFolder_OnChange ( browse_info info,
const LPCITEMIDLIST pidls,
LONG  event 
)
static

Definition at line 1198 of file brsfolder.c.

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 }
#define SHCNE_RMDIR
Definition: shlobj.h:1733
#define TRUE
Definition: types.h:120
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVGN_ROOT
Definition: commctrl.h:3448
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3410
struct _cl_event * event
Definition: glext.h:7739
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
#define SHCNE_DELETE
Definition: shlobj.h:1731
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HTREEITEM BrsFolder_FindItemByPidl(browse_info *info, LPCITEMIDLIST pidl, HTREEITEM hItem)
Definition: brsfolder.c:1171

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCommand()

static BOOL BrsFolder_OnCommand ( browse_info info,
UINT  id 
)
static

Definition at line 973 of file brsfolder.c.

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 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:388
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
#define IDOK
Definition: winuser.h:824
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
#define TRUE
Definition: types.h:120
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define FALSE
Definition: types.h:117
LPWSTR pszDisplayName
Definition: shlobj.h:1129
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
static HRESULT BrsFolder_NewFolder(browse_info *info)
Definition: brsfolder.c:842
LPCWSTR szPath
Definition: env.c:35
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define NULL
Definition: types.h:112
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:982
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:387

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnCreate()

static BOOL BrsFolder_OnCreate ( HWND  hWnd,
browse_info info 
)
static

Definition at line 760 of file brsfolder.c.

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 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:388
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:390
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
#define SW_HIDE
Definition: winuser.h:762
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:101
HWND hWnd
Definition: settings.c:17
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
LONG top
Definition: windef.h:307
#define HWND_TOP
Definition: winuser.h:1193
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1154
#define BIF_EDITBOX
Definition: shlobj.h:1148
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:391
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1753
#define FIXME(fmt,...)
Definition: debug.h:111
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1774
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:389
static LAYOUT_DATA * LayoutInit(HWND hwnd, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:136
LPCWSTR lpszTitle
Definition: shlobj.h:1130
#define BIF_STATUSTEXT
Definition: shlobj.h:1146
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1725
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
UINT ulFlags
Definition: shlobj.h:1131
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:127
static void InitializeTreeView(browse_info *info)
Definition: brsfolder.c:208
#define SUPPORTEDFLAGS
Definition: brsfolder.c:103
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:392
#define NULL
Definition: types.h:112
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:116
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
LONG bottom
Definition: windef.h:309
#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)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:86
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:387

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnDestroy()

static INT BrsFolder_OnDestroy ( browse_info info)
static

Definition at line 1153 of file brsfolder.c.

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 }
static __inline void LayoutDestroy(LAYOUT_DATA *pData)
Definition: layout.h:226
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnNotify()

static LRESULT BrsFolder_OnNotify ( browse_info info,
UINT  CtlID,
LPNMHDR  lpnmh 
)
static

Definition at line 721 of file brsfolder.c.

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 }
static LRESULT BrsFolder_Treeview_Expand(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:541
#define TVN_DELETEITEMA
Definition: commctrl.h:3703
#define WARN(fmt,...)
Definition: debug.h:112
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:576
#define TVN_SELCHANGEDA
Definition: commctrl.h:3643
UINT code
Definition: winuser.h:3134
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3708
UINT_PTR idFrom
Definition: winuser.h:3133
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3696
#define TVN_SELCHANGEDW
Definition: commctrl.h:3644
#define TVN_DELETEITEMW
Definition: commctrl.h:3704
#define TRACE(s)
Definition: solgame.cpp:4
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3707
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
Definition: brsfolder.c:674
static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv)
Definition: brsfolder.c:593
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:392
#define TVN_KEYDOWN
Definition: commctrl.h:3709
static LRESULT BrsFolder_Treeview_Delete(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:526
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3695

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetExpanded()

static BOOL BrsFolder_OnSetExpanded ( browse_info info,
LPVOID  selection,
BOOL  is_str,
HTREEITEM pItem 
)
static

Definition at line 1018 of file brsfolder.c.

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 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
HRESULT hr
Definition: shlfolder.c:183
struct tagTV_ITEMDATA * LPTV_ITEMDATA
#define TVM_EXPAND
Definition: commctrl.h:3415
#define TRUE
Definition: types.h:120
#define TVGN_NEXT
Definition: commctrl.h:3449
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
int selection
Definition: ctm.c:92
static BOOL _ILIsEqualSimple(LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
Definition: pidl.h:250
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVGN_ROOT
Definition: commctrl.h:3448
LONG_PTR LPARAM
Definition: windef.h:208
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:79
#define TVE_EXPAND
Definition: commctrl.h:3419
#define TVI_ROOT
Definition: commctrl.h:3364
#define TVGN_CHILD
Definition: commctrl.h:3452
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
LPITEMIDLIST lpi
Definition: brsfolder.c:73
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnSetSelectionW(), and BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionA()

static BOOL BrsFolder_OnSetSelectionA ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1120 of file brsfolder.c.

1120  {
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 }
GLuint64EXT * result
Definition: glext.h:11304
#define CP_ACP
Definition: compat.h:109
int selection
Definition: ctm.c:92
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1108
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by BrsFolderDlgProc().

◆ BrsFolder_OnSetSelectionW()

static BOOL BrsFolder_OnSetSelectionW ( browse_info info,
LPVOID  selection,
BOOL  is_str 
)
static

Definition at line 1108 of file brsfolder.c.

1108  {
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 }
#define TVM_SELECTITEM
Definition: commctrl.h:3474
#define TVGN_CARET
Definition: commctrl.h:3457
int selection
Definition: ctm.c:92
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem)
Definition: brsfolder.c:1018
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BrsFolder_OnSetSelectionA(), and BrsFolderDlgProc().

◆ BrsFolder_OnWindowPosChanging()

static LRESULT BrsFolder_OnWindowPosChanging ( browse_info info,
WINDOWPOS pos 
)
static

Definition at line 1140 of file brsfolder.c.

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 }
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
#define SWP_NOSIZE
Definition: winuser.h:1230

Referenced by BrsFolderDlgProc().

◆ BrsFolder_Rename()

static HRESULT BrsFolder_Rename ( browse_info info,
HTREEITEM  rename 
)
static

Definition at line 633 of file brsfolder.c.

634 {
636  SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
637  return S_OK;
638 }
#define TVM_SELECTITEM
Definition: commctrl.h:3474
#define TVGN_CARET
Definition: commctrl.h:3457
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)
LONG_PTR LPARAM
Definition: windef.h:208
#define TVM_EDITLABELW
Definition: commctrl.h:3496
#define S_OK
Definition: intsafe.h:51
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BrsFolder_NewFolder(), and BrsFolder_Treeview_Keydown().

◆ BrsFolder_Treeview_Changed()

static HRESULT BrsFolder_Treeview_Changed ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 576 of file brsfolder.c.

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 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:388
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:346
static void BrsFolder_CheckValidSelection(browse_info *info, LPTV_ITEMDATA lptvid)
Definition: brsfolder.c:490
LPARAM lParam
Definition: commctrl.h:3321
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3634
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define S_OK
Definition: intsafe.h:51
static void browsefolder_callback(LPBROWSEINFOW lpBrowseInfo, HWND hWnd, UINT msg, LPARAM param)
Definition: brsfolder.c:127
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
Definition: name.c:38
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify(), and BrsFolder_Treeview_Rename().

◆ BrsFolder_Treeview_Delete()

static LRESULT BrsFolder_Treeview_Delete ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 526 of file brsfolder.c.

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 }
TVITEMW itemOld
Definition: commctrl.h:3633
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
LPARAM lParam
Definition: commctrl.h:3321
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Expand()

static LRESULT BrsFolder_Treeview_Expand ( browse_info info,
NMTREEVIEWW pnmtv 
)
static

Definition at line 541 of file brsfolder.c.

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 }
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVM_SORTCHILDREN
Definition: commctrl.h:3537
BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
Definition: pidl.c:1920
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LPARAM lParam
Definition: commctrl.h:3321
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3281
#define FALSE
Definition: types.h:117
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
if SUCCEEDED(hr)
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3634
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void FillTreeView(browse_info *, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList *)
#define NULL
Definition: types.h:112
HTREEITEM hItem
Definition: commctrl.h:3313
UINT state
Definition: commctrl.h:3314
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Keydown()

static LRESULT BrsFolder_Treeview_Keydown ( browse_info info,
LPNMTVKEYDOWN  keydown 
)
static

Definition at line 674 of file brsfolder.c.

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 }
HRESULT hr
Definition: shlfolder.c:183
#define TVGN_CARET
Definition: commctrl.h:3457
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
Definition: brsfolder.c:633
#define VK_F2
Definition: winuser.h:2231
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
#define VK_DELETE
Definition: winuser.h:2208
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
LONG HRESULT
Definition: typedefs.h:79
#define TVIF_HANDLE
Definition: commctrl.h:3266
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
static ATOM item
Definition: dde.c:856
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolder_Treeview_Rename()

static LRESULT BrsFolder_Treeview_Rename ( browse_info info,
NMTVDISPINFOW pnmtv 
)
static

Definition at line 593 of file brsfolder.c.

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 }
struct tagTV_ITEMDATA * LPTV_ITEMDATA
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
#define TVGN_CARET
Definition: commctrl.h:3457
static HRESULT BrsFolder_Treeview_Changed(browse_info *info, NMTREEVIEWW *pnmtv)
Definition: brsfolder.c:576
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3260
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
LPARAM lParam
Definition: commctrl.h:3321
LPWSTR pszText
Definition: commctrl.h:3316
#define TVM_SETITEMW
Definition: commctrl.h:3489
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
TVITEMW itemNew
Definition: commctrl.h:3634
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TVIF_HANDLE
Definition: commctrl.h:3266
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define TVM_GETNEXTITEM
Definition: commctrl.h:3445
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static ATOM item
Definition: dde.c:856
#define TVIF_TEXT
Definition: commctrl.h:3262
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
TVITEMW item
Definition: commctrl.h:3668
#define TVM_GETITEMW
Definition: commctrl.h:3482
#define TVIF_PARAM
Definition: commctrl.h:3264
GLfloat GLfloat p
Definition: glext.h:8902
LPITEMIDLIST lpi
Definition: brsfolder.c:73

Referenced by BrsFolder_OnNotify().

◆ BrsFolderDlgProc()

static INT_PTR CALLBACK BrsFolderDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1224 of file brsfolder.c.

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 }
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:390
static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1120
#define LAYOUT_INFO_COUNT
Definition: brsfolder.c:101
static LRESULT BrsFolder_OnChange(browse_info *info, const LPCITEMIDLIST *pidls, LONG event)
Definition: brsfolder.c:1198
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HWND hWnd
Definition: settings.c:17
#define BFFM_SETSELECTIONA
Definition: shlobj.h:1172
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
char * LPSTR
Definition: xmlstorage.h:182
#define BFFM_SETEXPANDED
Definition: shlobj.h:1176
WPARAM wParam
Definition: combotst.c:138
static LRESULT BrsFolder_OnNotify(browse_info *info, UINT CtlID, LPNMHDR lpnmh)
Definition: brsfolder.c:721
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
struct tagMINMAXINFO * LPMINMAXINFO
#define SHV_CHANGE_NOTIFY
Definition: brsfolder.c:48
#define BFFM_SETSELECTIONW
Definition: shlobj.h:1173
static BOOL BrsFolder_OnSetSelectionW(browse_info *info, LPVOID selection, BOOL is_str)
Definition: brsfolder.c:1108
#define WM_DESTROY
Definition: winuser.h:1591
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static void LayoutUpdate(HWND hwnd, LAYOUT_DATA *data, const LAYOUT_INFO *layout_info, int layout_count)
Definition: brsfolder.c:165
#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
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
struct _test_info info[]
Definition: SetCursorPos.c:19
static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos)
Definition: brsfolder.c:1140
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
static INT BrsFolder_OnDestroy(browse_info *info)
Definition: brsfolder.c:1153
static BOOL BrsFolder_OnCommand(browse_info *info, UINT id)
Definition: brsfolder.c:973
#define BFFM_SETSTATUSTEXTA
Definition: shlobj.h:1170
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static BOOL BrsFolder_OnCreate(HWND hWnd, browse_info *info)
Definition: brsfolder.c:760
#define msg(x)
Definition: auth_time.c:54
static const WCHAR szBrowseFolderInfo[]
Definition: brsfolder.c:116
#define BFFM_SETOKTEXT
Definition: shlobj.h:1175
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define BFFM_SETSTATUSTEXTW
Definition: shlobj.h:1174
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
static const LAYOUT_INFO g_layout_info[]
Definition: brsfolder.c:86
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by SHBrowseForFolderW().

◆ FillTreeView() [1/2]

static void FillTreeView ( browse_info ,
LPSHELLFOLDER  ,
LPITEMIDLIST  ,
HTREEITEM  ,
IEnumIDList  
)
static

◆ FillTreeView() [2/2]

static void FillTreeView ( browse_info info,
IShellFolder lpsf,
LPITEMIDLIST  pidl,
HTREEITEM  hParent,
IEnumIDList lpe 
)
static

Definition at line 428 of file brsfolder.c.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:376
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
char * LPSTR
Definition: xmlstorage.h:182
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:122
if SUCCEEDED(hr)
#define IDC_WAIT
Definition: winuser.h:684
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
GLbitfield flags
Definition: glext.h:7161
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:51
HWND WINAPI SetCapture(_In_ HWND hWnd)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define NULL
Definition: types.h:112
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2889
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ GetIcon()

static int GetIcon ( LPCITEMIDLIST  lpi,
UINT  uFlags 
)
static

Definition at line 301 of file brsfolder.c.

302 {
303  SHFILEINFOW sfi;
304  SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
305  return sfi.iIcon;
306 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
UINT uFlags
Definition: api.c:59
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413

Referenced by DECLARE_INTERFACE_(), and GetNormalAndSelectedIcons().

◆ GetName()

static BOOL GetName ( LPSHELLFOLDER  lpsf,
LPCITEMIDLIST  lpi,
DWORD  dwFlags,
LPWSTR  lpFriendlyName 
)
static

Definition at line 346 of file brsfolder.c.

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 }
#define TRUE
Definition: types.h:120
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85

Referenced by BrsFolder_Treeview_Changed(), and InsertTreeViewItem().

◆ GetNormalAndSelectedIcons()

static void GetNormalAndSelectedIcons ( LPITEMIDLIST  lpifq,
LPTVITEMW  lpTV_ITEM 
)
static

Definition at line 308 of file brsfolder.c.

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 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1602
int iImage
Definition: commctrl.h:3318
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static int GetIcon(LPCITEMIDLIST lpi, UINT uFlags)
Definition: brsfolder.c:301
int iSelectedImage
Definition: commctrl.h:3319
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by InsertTreeViewItem().

◆ InitializeTreeView()

static void InitializeTreeView ( browse_info info)
static

Definition at line 208 of file brsfolder.c.

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 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
static BOOL _ILIsEmpty(LPCITEMIDLIST pidl)
Definition: pidl.h:256
static HTREEITEM InsertTreeViewItem(browse_info *, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList *, HTREEITEM)
Definition: brsfolder.c:376
HRESULT hr
Definition: shlfolder.c:183
#define TVM_EXPAND
Definition: commctrl.h:3415
#define WARN(fmt,...)
Definition: debug.h:112
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
static DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
Definition: brsfolder.c:122
#define TVM_SETIMAGELIST
Definition: commctrl.h:3442
LONG_PTR LPARAM
Definition: windef.h:208
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVE_EXPAND
Definition: commctrl.h:3419
GLbitfield flags
Definition: glext.h:7161
#define TVI_ROOT
Definition: commctrl.h:3364
#define TVM_DELETEITEM
Definition: commctrl.h:3410
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
static ATOM item
Definition: dde.c:856
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by BrsFolder_OnCreate().

◆ InsertTreeViewItem()

static HTREEITEM InsertTreeViewItem ( browse_info info,
IShellFolder lpsf,
LPCITEMIDLIST  pidl,
LPCITEMIDLIST  pidlParent,
IEnumIDList pEnumIL,
HTREEITEM  hParent 
)
static

Definition at line 376 of file brsfolder.c.

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 }
int cchTextMax
Definition: commctrl.h:3317
HTREEITEM hParent
Definition: commctrl.h:3389
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
Definition: brsfolder.c:308
LPITEMIDLIST lpifq
Definition: brsfolder.c:74
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
Definition: brsfolder.c:346
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
LPARAM lParam
Definition: commctrl.h:3321
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
UINT mask
Definition: commctrl.h:3312
LPWSTR pszText
Definition: commctrl.h:3316
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVIF_CHILDREN
Definition: commctrl.h:3268
HTREEITEM hInsertAfter
Definition: commctrl.h:3390
IEnumIDList * pEnumIL
Definition: brsfolder.c:75
LONG_PTR LPARAM
Definition: windef.h:208
LPSHELLFOLDER lpsfParent
Definition: brsfolder.c:72
int cChildren
Definition: commctrl.h:3320
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define TVIF_TEXT
Definition: commctrl.h:3262
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define NULL
Definition: types.h:112
#define TVIF_PARAM
Definition: commctrl.h:3264
LPITEMIDLIST lpi
Definition: brsfolder.c:73
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

Referenced by BrsFolder_NewFolder(), FillTreeView(), and InitializeTreeView().

◆ LayoutInit()

static LAYOUT_DATA* LayoutInit ( HWND  hwnd,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 136 of file brsfolder.c.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG right
Definition: windef.h:308
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
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
#define HWND_DESKTOP
Definition: winuser.h:1195
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

Referenced by BrsFolder_OnCreate().

◆ LayoutUpdate()

static void LayoutUpdate ( HWND  hwnd,
LAYOUT_DATA data,
const LAYOUT_INFO layout_info,
int  layout_count 
)
static

Definition at line 165 of file brsfolder.c.

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define BF_BOTTOM
Definition: winuser.h:457
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BF_RIGHT
Definition: winuser.h:456
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
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
#define BF_TOP
Definition: winuser.h:455
#define HWND_DESKTOP
Definition: winuser.h:1195
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
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 BF_LEFT
Definition: winuser.h:454

Referenced by BrsFolderDlgProc().

◆ PIDLIsType()

static BOOL PIDLIsType ( LPCITEMIDLIST  pidl,
PIDLTYPE  type 
)
inlinestatic

Definition at line 482 of file brsfolder.c.

483 {
485  if (!data)
486  return FALSE;
487  return (data->type == type);
488 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
#define FALSE
Definition: types.h:117
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by BrsFolder_CheckValidSelection().

◆ SHBrowseForFolderA()

LPITEMIDLIST WINAPI SHBrowseForFolderA ( LPBROWSEINFOA  lpbi)

Definition at line 1308 of file brsfolder.c.

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 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
HWND hwndOwner
Definition: shlobj.h:1127
BFFCALLBACK lpfn
Definition: shlobj.h:1121
int32_t INT
Definition: typedefs.h:58
LPSTR pszDisplayName
Definition: shlobj.h:1118
LPWSTR pszDisplayName
Definition: shlobj.h:1129
LPCWSTR lpszTitle
Definition: shlobj.h:1130
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1117
LPCSTR lpszTitle
Definition: shlobj.h:1119
GLenum GLsizei len
Definition: glext.h:6722
PCIDLIST_ABSOLUTE pidlRoot
Definition: shlobj.h:1128
UINT ulFlags
Definition: shlobj.h:1120
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brsfolder.c:1357
LPARAM lParam
Definition: shlobj.h:1122
UINT ulFlags
Definition: shlobj.h:1131
LPARAM lParam
Definition: shlobj.h:1133
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HWND hwndOwner
Definition: shlobj.h:1116
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static char title[]
Definition: ps.c:92
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_click_make_new_folder_button(), and test_selection().

◆ SHBrowseForFolderW()

LPITEMIDLIST WINAPI SHBrowseForFolderW ( LPBROWSEINFOW  lpbi)

Definition at line 1357 of file brsfolder.c.

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 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HRESULT hr
Definition: shlfolder.c:183
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HWND hwndOwner
Definition: shlobj.h:1127
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
if SUCCEEDED(hr)
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_BROWSE_FOR_FOLDER
Definition: shresdef.h:385
#define BIF_NEWDIALOGSTYLE
Definition: shlobj.h:1150
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDD_BROWSE_FOR_FOLDER_NEW
Definition: shresdef.h:386
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
UINT ulFlags
Definition: shlobj.h:1131
#define shell32_hInstance
#define NULL
Definition: types.h:112
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: brsfolder.c:1224
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230

Referenced by CBandSiteMenu::_CreateNewISFBand(), BtrfsSend::AddClone(), CShellDispatch::BrowseForFolder(), BtrfsSend::BrowseParent(), ChooseFolder(), FileExtractDialogWndProc(), CZipExtract::CExtractSettingsPage::OnBrowse(), SHBrowseForFolderA(), SHBrowseForFolderWrapW(), and WelcomeDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_layout_info

const LAYOUT_INFO g_layout_info[]
static
Initial value:
=
{
}
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:388
#define IDC_BROWSE_FOR_FOLDER_STATUS
Definition: shresdef.h:390
#define IDOK
Definition: winuser.h:824
#define BF_BOTTOM
Definition: winuser.h:457
#define IDC_BROWSE_FOR_FOLDER_TITLE
Definition: shresdef.h:391
#define IDC_BROWSE_FOR_FOLDER_FOLDER
Definition: shresdef.h:389
#define BF_RIGHT
Definition: winuser.h:456
#define BF_TOP
Definition: winuser.h:455
#define IDC_BROWSE_FOR_FOLDER_TREEVIEW
Definition: shresdef.h:392
#define IDCANCEL
Definition: winuser.h:825
#define IDC_BROWSE_FOR_FOLDER_NEW_FOLDER
Definition: shresdef.h:387
#define BF_LEFT
Definition: winuser.h:454

Definition at line 86 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().

◆ swBrowseTemplateName

const WCHAR swBrowseTemplateName[]
static
Initial value:
= {
'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}

Definition at line 1298 of file brsfolder.c.

◆ swNewBrowseTemplateName

const WCHAR swNewBrowseTemplateName[]
static
Initial value:
= {
'S','H','N','E','W','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0}

Definition at line 1300 of file brsfolder.c.

◆ szBrowseFolderInfo

const WCHAR szBrowseFolderInfo[]
static
Initial value:
= {
'_','_','W','I','N','E','_',
'B','R','S','F','O','L','D','E','R','D','L','G','_',
'I','N','F','O',0
}

Definition at line 116 of file brsfolder.c.

Referenced by BrsFolder_OnCreate(), and BrsFolderDlgProc().